Copia locale Iniziale

This commit is contained in:
Carlo Baronchelli
2022-05-19 16:04:07 +02:00
parent 225647b06d
commit 741791a0e4
1626 changed files with 228080 additions and 0 deletions
+657
View File
@@ -0,0 +1,657 @@
-- BatchProcess.lua by Egaltech s.r.l. 2022/02/24
-- Gestione calcolo batch disposizione e lavorazioni per Pareti
-- 2020/07/24 Nuvola di punti riferita allo Zero Tavola.
-- 2020/10/28 Corretto spostamento pezzi per rotazioni (0 o 180) e inversioni( 0, 90, 180, o 270).
-- 2020/12/03 Ora riconosciute rotazioni di inversione con angoli negativi.
-- 2021/03/05 Aggiunta gestione altri angoli di inversione e rotazione combinati.
-- 2021/03/06 La creazione del file ori si fa solo alla fine se non ci sono stati errori o se edit.
-- 2021/03/08 Aggiunta gestione lavorazione su macchine per travi.
-- 2021/04/09 Corretto spostamento pezzi per rotazioni e inversioni.
-- 2021/07/28 Aggiunta scelta direzione di vista per modifica e simulazione.
-- 2021/10/27 Nel controllo spessore si deve considerare anche PosY.
-- 2022/02/24 Se ricalcolo si aggiorna il setup. In ogni caso si verifica prima di simulazione.
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Per test
--WALL = {}
--WALL.FILE = 'c:\\TechnoEssetre7\\EgtData\\Prods\\0010\\Bar_10_1.btl'
--WALL.MACHINE = '90480019_MW'
--WALL.FLAG = 5
-- Log dati in input
local sFlag = ''
if WALL.FLAG == 0 then
sFlag = 'GENERATE'
elseif WALL.FLAG == 1 then
sFlag = 'MODIFY'
elseif WALL.FLAG == 2 then
sFlag = 'SIMULATE'
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
sFlag = 'JOBS'
else
sFlag = 'FLAG='..tostring( WALL.FLAG)
end
local sLog = 'BatchProcess : ' .. WALL.FILE .. ', ' .. WALL.MACHINE .. ', ' .. sFlag
EgtOutLog( sLog)
-- Cancello file di log specifico
local sLogFile = EgtChangePathExtension( WALL.FILE, '.txt')
EgtEraseFile( sLogFile)
-- Funzioni per scrittura su file di log specifico
local function WriteErrToLogFile( nErr, sMsg, nRot, nCutId, nTaskId)
local hFile = io.open( sLogFile, 'a')
hFile:write( 'ERR=' .. tostring( nErr) .. '\n')
hFile:write( sMsg .. '\n')
hFile:write( 'ROT=' .. tostring( nRot or 0) .. '\n')
hFile:write( 'CUTID=' .. tostring( nCutId or 0) .. '\n')
hFile:write( 'TASKID=' .. tostring( nTaskId or 0) .. '\n')
hFile:close()
end
local function WriteTimeToLogFile( dTime)
local hFile = io.open( sLogFile, 'a')
hFile:write( 'TIME=' .. EgtNumToString( dTime) .. '\n')
hFile:close()
end
-- Funzione per gestire visualizzazione dopo errore
local function PostErrView( nErr, sMsg)
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')
end
end
-- Funzione per gestire visualizzazione dopo warning
local function PostWarnView( nWarn, sMsg)
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')
end
end
-- Funzione per aggiornare dati ausiliari
local function UpdateAuxData( sAuxFile)
local bModif = false
-- Se definito LOAD90, aggiorno
local sLoad90 = EgtGetStringFromIni( 'AuxData', 'LOAD90', '', sAuxFile)
if sLoad90 ~= '' then
local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
EgtSetInfo( BtlInfoId, 'LOAD90', sLoad90)
bModif = true
end
return bModif
end
-- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Impostazione della macchina corrente
EgtResetCurrMachGroup()
local sMachine = 'Essetre-' .. WALL.MACHINE
if not EgtSetCurrMachine( sMachine) then
WALL.ERR = 11
WALL.MSG = 'Error selecting machine : ' .. sMachine
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Travi
local sMachDir = EgtGetCurrMachineDir()
if not EgtExistsFile( sMachDir .. '\\Wall\\WallData.lua') then
WALL.ERR = 12
WALL.MSG = 'Error not configured for walls machine : ' .. sMachine
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie
EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Wall\\?.lua')
-- Se modalità visualizzazione finestre per DB esco
if WALL.FLAG > 10 then
WALL.ERR = 0
return
end
-- Carico le librerie
_G.package.loaded.WallExec = nil
local WE = require( 'WallExec')
--local BL = require( 'BeamLib')
-- Carico i dati globali
local WD = require( 'WallData')
-- Dati del file
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
local bToRecalc = false
-- se BTL, barra ed esiste già il corrispondente progetto Nge
if bBtl and string.find( sTitle, 'Bar_', 1, true) and EgtExistsFile( sNgeFile) then
local sOriFile = sDir..sTitle..'.ori'..sExt
local sDiffFile = sDir..sTitle..'.diff.txt'
EgtEraseFile( sDiffFile)
local _, nDiff = EgtTextFileCompare( WALL.FILE, sOriFile, ';', sDiffFile)
-- se BTL corrente coincide con originale, salto il riprocessamento
if nDiff == 0 then
bToProcess = false
-- se cambiata configurazione macchina da ultima elaborazione, devo riprocessare
if EgtCompareFilesLastWriteTime( sOriFile, sMachDir .. '\\Wall\\TS3Data.lua') == -1 or
EgtCompareFilesLastWriteTime( sOriFile, sMachDir .. '\\Tools\\Tools.data') == -1 then
bToRecalc = true
end
end
end
-- Inizializzo contatori errori e avvisi
local nErrCnt = 0
local nWarnCnt = 0
-- Se da elaborare
if bToProcess then
EgtOutLog( ' +++ Processing Parts >>>')
-- Se Btl, lo importo
if bBtl then
-- cancello eventuale vecchio progetto omonimo
EgtEraseFile( sNgeFile)
-- eseguo import
EgtNewFile()
if not EgtImportBtl( WALL.FILE, EIB_FL.TS3_POS + EIB_FL.USEUATTR) then
WALL.ERR = 13
WALL.MSG = 'Error importing BTL file : ' .. WALL.FILE
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
-- altrimenti Nge, lo apro
else
if not EgtOpenFile( WALL.FILE) then
WALL.ERR = 13
WALL.MSG = 'Error opening NGE file : ' .. WALL.FILE
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
end
-- Aggiorno eventuali dati ausiliari
UpdateAuxData( sBtmFile)
-- Recupero informazione se progetto o produzione
local bProj = ( EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'PROJECT', 'i') == 1)
-- Dimensioni del pannello
local dRawL = ( EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'PANELLEN', 'd') or 100)
local dRawW = ( EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'PANELWIDTH', 'd') or 50)
local dExtraL = 0
local dExtraW = 0
if bProj then
if WD.BEAM_MACHINE then
if dRawL < WD.MIN_LENGTH then
dExtraL = WD.MIN_LENGTH - dRawL
dRawL = WD.MIN_LENGTH
elseif dRawL < WD.MAX_LENGTH then
dExtraL = min( WD.MAX_LENGTH - dRawL, 3000)
dRawL = dRawL + dExtraL
end
if dRawW + 10 < WD.MIN_WIDTH then
dExtraW = WD.MIN_WIDTH - dRawW
dRawW = WD.MIN_WIDTH
elseif dRawW < WD.MAX_WIDTH then
dExtraW = min( WD.MAX_WIDTH - dRawW, 10)
dRawW = dRawW + dExtraW
end
else
dExtraW = 10
dRawW = dRawW + dExtraW
end
end
-- Recupero l'elenco ordinato delle pareti
local vWall = {}
local nPartId = EgtGetFirstPart()
while nPartId do
table.insert( vWall, { Id = nPartId, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))})
nPartId = EgtGetNextPart( nPartId)
end
if #vWall == 0 then
WALL.ERR = 14
WALL.MSG = 'Error no beams in the file : ' .. WALL.FILE
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
else
local sOut = ''
for i = 1, #vWall do
sOut = sOut .. vWall[i].Name .. ', '
end
sOut = sOut:sub( 1, -3)
EgtOutLog( 'Travi trovate : ' .. sOut, 1)
end
-- Ne recupero le dimensioni
for i = 1, #vWall do
local Ls = EgtGetFirstNameInGroup( vWall[i].Id, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
WALL.ERR = 15
WALL.MSG = 'Box undefined for beam ' .. vWall[i].Name
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
else
vWall[i].Box = b3Solid
end
end
-- Ne recupero la posizione
for i = 1, #vWall do
local PosX = EgtGetInfo( vWall[i].Id, 'POSX', 'd')
vWall[i].PosX = PosX + min( dExtraL, 1200)
if WD.USE_POSY then
local PosY = EgtGetInfo( vWall[i].Id, 'POSY', 'd')
vWall[i].PosY = max( PosY, 0)
else
vWall[i].PosY = 0
end
local PosZ = EgtGetInfo( vWall[i].Id, 'POSZ', 'd')
vWall[i].PosZ = PosZ + dExtraW / 2
end
-- Eseguo eventuali rotazioni e inversioni testa-coda
for i = 1, #vWall do
local b3Solid = vWall[i].Box
-- rotazione
local dRotAng = EgtGetInfo( vWall[i].Id, 'ROTATED', 'd')
if dRotAng then
if abs( dRotAng) > GEO.EPS_ANG_SMALL then
local ptRotCen = b3Solid:getCenter()
EgtRotate( vWall[i].Id, ptRotCen, X_AX(), dRotAng, GDB_RT.GLOB)
b3Solid:rotate( ptRotCen, X_AX(), dRotAng)
end
EgtSetInfo( vWall[i].Id, 'ROTATED_DONE', dRotAng)
end
-- inversione
local dInvAng = EgtGetInfo( vWall[i].Id, 'INVERTED', 'd')
if dInvAng then
if abs( dInvAng - 180) > GEO.EPS_ANG_SMALL and abs( dInvAng + 180) > GEO.EPS_ANG_SMALL then
local ptInvCen = b3Solid:getCenter()
EgtRotate( vWall[i].Id, ptInvCen, Z_AX(), dInvAng - 180, GDB_RT.GLOB)
b3Solid:rotate( ptInvCen, Z_AX(), dInvAng - 180)
end
EgtSetInfo( vWall[i].Id, 'INVERTED_DONE', dInvAng)
end
-- correzioni per rotazioni non centrate di produzioni TS3 (quasi sempre multipli di 90 deg)
local sType = EgtGetInfo( vWall[i].Id, 'TYPE', 's')
if not bProj and dRotAng and dInvAng and sType ~= 'LAYER' then
if abs( dInvAng - 0) < GEO.EPS_ANG_SMALL then
if abs( dRotAng - 180) < GEO.EPS_ANG_SMALL then
vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY()
elseif abs( dRotAng - 270) < GEO.EPS_ANG_SMALL then
vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY()
end
elseif abs( dInvAng - 90) < GEO.EPS_ANG_SMALL or abs( dInvAng + 270) < GEO.EPS_ANG_SMALL then
vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY()
if abs( dRotAng - 180) < GEO.EPS_ANG_SMALL or abs( dRotAng + 180) < GEO.EPS_ANG_SMALL then
vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX()
elseif abs( dRotAng - 270) < GEO.EPS_ANG_SMALL or abs( dRotAng + 90) < GEO.EPS_ANG_SMALL then
vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX()
end
elseif abs( dInvAng - 180) < GEO.EPS_ANG_SMALL or abs( dInvAng + 180) < GEO.EPS_ANG_SMALL then
vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX()
if abs( dRotAng - 0) < GEO.EPS_ANG_SMALL then
vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY()
elseif abs( dRotAng - 270) < GEO.EPS_ANG_SMALL or abs( dRotAng + 90) < GEO.EPS_ANG_SMALL then
vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY()
elseif abs( dRotAng - 90) < GEO.EPS_ANG_SMALL or abs( dRotAng + 270) < GEO.EPS_ANG_SMALL then
vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY()
end
elseif abs( dInvAng - 270) < GEO.EPS_ANG_SMALL or abs( dInvAng + 90) < GEO.EPS_ANG_SMALL then
if abs( dRotAng - 0) < GEO.EPS_ANG_SMALL then
vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX()
end
end
end
end
-- Ne verifico le dimensioni
local dRawH = vWall[1].Box:getDimZ() + vWall[1].PosY
local vWallErr = {}
for i = 2, #vWall do
local dDimH = vWall[i].Box:getDimZ() + vWall[i].PosY
if abs( dDimH - dRawH) > 10 * GEO.EPS_SMALL then
table.insert( vWallErr, i)
end
end
if #vWallErr > 0 then
local sOut = 'Rimosse pareti con spessore diverso dalla prima :\n'
for i = #vWallErr, 1, -1 do
sOut = sOut .. vWall[vWallErr[i]].Name .. '\n'
table.remove( vWall, vWallErr[i])
end
WALL.ERR = 16
WALL.MSG = sOut
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
-- Verifico dimensioni massime grezzo
if dRawL > WD.MAX_LENGTH + 10 * GEO.EPS_SMALL or dRawW > WD.MAX_WIDTH + 10 * GEO.EPS_SMALL or dRawH > WD.MAX_HEIGHT + 10 * GEO.EPS_SMALL then
local sOut = 'Grezzo (' .. EgtNumToString( dRawL, 2) .. ' x ' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' ..
'oltre il limite della macchina ('..EgtNumToString( WD.MAX_LENGTH, 2)..' x '..EgtNumToString( WD.MAX_WIDTH, 2)..' x '..EgtNumToString( WD.MAX_HEIGHT, 2)..') '
WALL.ERR = 17
WALL.MSG = sOut
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
-- Verifico dimensioni minime del grezzo
if dRawL < WD.MIN_LENGTH - 10 * GEO.EPS_SMALL or dRawW < WD.MIN_WIDTH - 10 * GEO.EPS_SMALL or dRawH < WD.MIN_HEIGHT - 10 * GEO.EPS_SMALL then
local sOut = 'Grezzo (' .. EgtNumToString( dRawL, 2) .. ' x ' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' ..
'sotto il limite della macchina ('..EgtNumToString( WD.MIN_LENGTH, 2)..' x '..EgtNumToString( WD.MIN_WIDTH, 2)..' x '..EgtNumToString( WD.MIN_HEIGHT, 2)..')'
WALL.ERR = 17
WALL.MSG = sOut
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
-- Sistemo le pareti nel grezzo
local bPbOk, sPbErr = WE.ProcessWalls( dRawL, dRawW, dRawH, vWall)
if not bPbOk then
WALL.ERR = 18
WALL.MSG = sPbErr
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
-- Imposto Nome file CN
local _, sName, _ = EgtSplitPath( WALL.FILE)
EgtSetInfo( EgtGetCurrMachGroup(), 'NcName', sName .. '.cnc')
-- 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 or '', '\n', ' ', 10)
sMsg = string.gsub( sMsg or '', '\r', ' ', 10)
if Stats[i].Err == 0 then
WALL.ERR = 0
WALL.MSG = '---'
WALL.ROT = Stats[i].Rot or 0
WALL.CUTID = Stats[i].CutId
WALL.TASKID = Stats[i].TaskId
WriteErrToLogFile( WALL.ERR, WALL.MSG, WALL.ROT, WALL.CUTID, WALL.TASKID)
elseif Stats[i].Err > 0 then
nErrCnt = nErrCnt + 1
sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg)
WALL.ERR = 19
WALL.MSG = sMsg
WALL.ROT = Stats[i].Rot or 0
WALL.CUTID = Stats[i].CutId
WALL.TASKID = Stats[i].TaskId
WriteErrToLogFile( WALL.ERR, WALL.MSG, WALL.ROT, WALL.CUTID, WALL.TASKID)
elseif Stats[i].Err < 0 then
nWarnCnt = nWarnCnt + 1
sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg)
WALL.ERR = -19
WALL.MSG = sMsg
WALL.ROT = Stats[i].Rot or 0
WALL.CUTID = Stats[i].CutId
WALL.TASKID = Stats[i].TaskId
WriteErrToLogFile( WALL.ERR, WALL.MSG, WALL.ROT, WALL.CUTID, WALL.TASKID)
end
end
-- Salvo il progetto
EgtSaveFile( sNgeFile)
-- Se non ci sono errori o modalità modifica, salvo il file originale
if nErrCnt == 0 or WALL.FLAG == 1 then
EgtCopyFile( WALL.FILE, sDir..sTitle..'.ori'..sExt)
end
-- Visualizzazione avvisi o errori
if #sOutput > 0 then EgtOutLog( sOutput) end
if nErrCnt > 0 then
PostErrView( 19, sOutput)
elseif nWarnCnt > 0 then
PostWarnView( 19, sOutput)
end
-- Altrimenti carico il progetto salvato e dichiaro nessun errore
else
EgtOutLog( ' +++ Loading Project already processed >>>')
-- Carico il progetto già fatto
EgtOpenFile( sNgeFile)
-- Dichiaro nessun errore
local nPartId = EgtGetFirstPart()
while nPartId do
local nCutId = EgtGetInfo( nPartId, 'CUTID')
if nCutId then
local LayerId = {}
LayerId[1] = EgtGetFirstNameInGroup( nPartId, 'Outline')
LayerId[2] = EgtGetFirstNameInGroup( nPartId, 'Processings')
for nInd = 1, #LayerId do
local nProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL)
while nProcId do
local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC')
local nTaskId = EgtGetInfo( nProcId, 'TASKID')
if bIsFea and nTaskId then
WALL.ERR = 0
WALL.MSG = '---'
WALL.ROT = 0
WALL.CUTID = nCutId
WALL.TASKID = nTaskId
WriteErrToLogFile( WALL.ERR, WALL.MSG, WALL.ROT, WALL.CUTID, WALL.TASKID)
end
nProcId = EgtGetNext( nProcId)
end
end
end
nPartId = EgtGetNextPart( nPartId)
end
-- Aggiorno eventuali dati ausiliari
UpdateAuxData( sBtmFile)
-- Passo in modalità lavora
EgtSetCurrMachGroup( EgtGetLastMachGroup())
-- Se necessario eseguo aggiornamento con ricalcolo delle lavorazioni
if bToRecalc then
EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>')
EgtImportSetup()
EgtApplyAllMachinings()
-- copia del file btl originale (per dichiarare progetto ricalcolato)
EgtCopyFile( WALL.FILE, sDir..sTitle..'.ori'..sExt)
end
-- Salvo il progetto
EgtSaveFile( sNgeFile)
end
-- *** Eseguo simulazione con verifica collisione in cieco ***
if ( WALL.FLAG == 0 and ( bToProcess or bToRecalc)) or WALL.FLAG == 3 or WALL.FLAG == 4 then
EgtOutLog( ' +++ Simulating with collision check >>>')
-- verifico setup
local bSetUpOk, SetUpErrors = EgtVerifyCurrSetup()
if not bSetUpOk then
local sToolsList = ""
for ToolIndex = 1, #SetUpErrors do
sToolsList = sToolsList .. SetUpErrors[ToolIndex]
if ToolIndex ~= #SetUpErrors then
sToolsList = sToolsList .. ", "
end
end
WriteErrToLogFile( 19, 'Error in setup: tool/s ' .. sToolsList .. ' not found', 0, 0, 0)
return
end
-- lancio simulazione
local bSimOk, nErr, sErr = EgtSimulate()
if not bSimOk then
if nErr == MCH_SHE.INIT then
WALL.ERR = 19
WALL.MSG = 'Error starting simulation'
elseif nErr == MCH_SHE.COLLISION then
WALL.ERR = 22
WALL.MSG = 'Head-part collision'
elseif nErr == MCH_SHE.OUTSTROKE then
WALL.ERR = 23
WALL.MSG = 'Axis outstroke ' .. sErr
elseif nErr == MCH_SHE.SPECIAL then
WALL.ERR = 24
WALL.MSG = 'Special error ' .. sErr
else
WALL.ERR = 25
WALL.MSG = 'General failure (contact supplier)'
end
WALL.ROT = 0
WALL.CUTID = 0
WALL.TASKID = 0
local vItem = EgtSplitString( sErr, ';') or {}
for i = 1, #vItem do
vItem[i] = EgtTrim( vItem[i] or '')
if string.find( vItem[i], 'CUTID', 1, true) then
WALL.CUTID = EgtGetVal( vItem[i], 'CUTID', 'i') or 0
elseif string.find( vItem[i], 'TASKID', 1, true) then
WALL.TASKID = EgtGetVal( vItem[i], 'TASKID', 'i') or 0
end
end
WriteErrToLogFile( WALL.ERR, WALL.MSG, WALL.ROT, WALL.CUTID, WALL.TASKID)
return
end
end
-- *** Genero programma CN *** ( se richiesto)
if WALL.FLAG == 0 or WALL.FLAG == 4 then
EgtOutLog( ' +++ Generating NC part program >>>')
local sInfo = 'EgtCAM5 - '
if EgtGetExeVersion then
sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - '
end
if not EgtGenerate( '', sInfo .. sNgeFile) then
WALL.ERR = 20
local _, sName, _ = EgtSplitPath( WALL.FILE)
WALL.MSG = 'Error generating NC part program : ' .. sName
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
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
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
local Ttot = EgtGetInfo( EgtGetCurrMachGroup(), 'Ttot')
local sTime = 'Total Time = ' .. EgtNumToString( Ttot, 1)
EgtOutLog( sTime)
-- 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 opportuna
if WALL.FLAG == 1 or WALL.FLAG == 2 then
local vView = { SCE_VD.ISO_NW, SCE_VD.ISO_SW, SCE_VD.ISO_NE, SCE_VD.ISO_SE}
local nV = min( max( WD.SIMUL_VIEW_DIR or 2, 1), 4)
EgtSetView( vView[nV], false)
-- se cloud, imposto la vista TOP
elseif WALL.FLAG == 5 then
EgtSetView( SCE_VD.TOP, false)
end
-- Completamento senza errori e avvisi
if nWarnCnt == 0 then
WALL.ERR = 0
WALL.MSG = '---'
WriteErrToLogFile( WALL.ERR, WALL.MSG)
end
-- Scrittura tempo totale stimato di lavorazione
WriteTimeToLogFile( Ttot)
EgtOutLog( ' +++ BatchProcess completed')
@@ -0,0 +1,713 @@
-- BatchProcess.lua by Egaltech s.r.l. 2022/01/20
-- Gestione calcolo batch disposizione e lavorazioni per Pareti
-- 2021/01/15 Per nuova interfaccia Egt.
-- 2021/11/10 Aggiunta modifica per gestione modifiche manuali come in Beam.
-- 2022/01/06 Per CUTID/TASKID senza ToProcess si verificano anche eventuali Duplo.
-- 2022/01/17 Eliminata assegnazione Feature ok se non calcolata.
-- 2022/01/20 Si aggiorna il setup anche quando si creano le lavorazioni (MachGroup vecchio...).
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( true)
-- Per test --**CB: inizializzazione**
--WALL = {}
--WALL.FILE = 'c:\\TechnoEssetre7\\EgtData\\Prods\\0010\\Bar_10_1.btl'
--WALL.MACHINE = 'Essetre-90480019_MW'
--WALL.FLAG = 3
-- Log dati in input
local sFlag = ''
if WALL.FLAG == 0 then
sFlag = 'GENERATE'
elseif WALL.FLAG == 1 then
sFlag = 'MODIFY'
elseif WALL.FLAG == 2 then
sFlag = 'SIMULATE'
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 == 6 then
sFlag = 'CREATE_PANEL'
else
sFlag = 'FLAG='..tostring( WALL.FLAG)
end
local sLog = 'BatchProcess : ' .. WALL.FILE .. ', ' .. WALL.MACHINE .. ', ' .. sFlag
EgtOutLog( sLog)
-- Cancello file di log specifico
local sLogFile = EgtChangePathExtension( WALL.FILE, '.txt')
EgtEraseFile( sLogFile)
-- Funzioni per scrittura su file di log specifico
local function WriteErrToLogFile( nErr, sMsg, nRot, nCutId, nTaskId)
local hFile = io.open( sLogFile, 'a')
hFile:write( 'ERR=' .. tostring( nErr) .. '\n')
hFile:write( sMsg .. '\n')
hFile:write( 'ROT=' .. tostring( nRot or 0) .. '\n')
hFile:write( 'CUTID=' .. tostring( nCutId or 0) .. '\n')
hFile:write( 'TASKID=' .. tostring( nTaskId or 0) .. '\n')
hFile:close()
end
local function BWMessageId( nMsgId, sMsg, params)
if WALL.BW and nMsgId and nMsgId > 0 then
local sFinalMsg = '$$' .. nMsgId
for Index = 1, #params do
sFinalMsg = sFinalMsg .. ',' .. params[Index]
end
return sFinalMsg
else
return string.format( sMsg, table.unpack( params))
end
end
local function WriteTimeToLogFile( dTime)
local hFile = io.open( sLogFile, 'a')
hFile:write( 'TIME=' .. EgtNumToString( dTime) .. '\n')
hFile:close()
end
-- Funzione per gestire visualizzazione dopo errore
local function PostErrView( nErr, sMsg)
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')
end
end
-- Funzione per gestire visualizzazione dopo warning
local function PostWarnView( nWarn, sMsg)
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')
end
end
-- Funzione per aggiornare dati ausiliari
local function UpdateAuxData( sAuxFile)
local bModif = false
-- Se definito LOAD90, aggiorno
local sLoad90 = EgtGetStringFromIni( 'AuxData', 'LOAD90', '', sAuxFile)
if sLoad90 ~= '' then
local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
EgtSetInfo( BtlInfoId, 'LOAD90', sLoad90)
bModif = true
end
return bModif
end
-- Funzione di reset gruppo di lavoro in caso di impossibilità di inserire i pezzi
local function ResetMachGroup( vWall)
for i = 1, #vWall do
EgtErase( vWall[i].Id)
end
EgtRemoveMachGroup( EgtGetCurrMachGroup() or GDB_ID.NULL)
end
-- **CB: INIZIO PROGRAMMA**
-- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Se necessario, impostazione della macchina corrente
local sMachine = WALL.MACHINE
if WALL.FLAG ~= 6 then
EgtResetCurrMachGroup()
if not EgtSetCurrMachine( sMachine) then
WALL.ERR = 11
WALL.MSG = 'Error selecting machine : ' .. sMachine
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
end
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Pareti
local sMachDir = EgtGetCurrMachineDir()
if not EgtExistsFile( sMachDir .. '\\Wall\\WallData.lua') then
WALL.ERR = 12
WALL.MSG = 'Error not configured for walls machine : ' .. sMachine
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie
EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Wall\\?.lua')
-- Carico le librerie
_G.package.loaded.WallExec = nil
local WE = require( 'WallExec')
local WL = require( 'WallLib')
-- Carico i dati globali
local WD = require( 'WallData')
-- Dati del file
local sDir, sTitle, sExt = EgtSplitPath( WALL.FILE)
local sOriFile = sDir..sTitle..'.ori.bwe'
local sNgeFile = sDir..sTitle..'.bwe'
local sBtmFile = sDir..sTitle..'.btm'
local sPntFile = sDir..sTitle..'.pnt'
-- In generale va completamente riprocessato
local bToProcess = true
local bToRecalc = false
-- se BTL, barra ed esiste già il corrispondente progetto Nge
if EgtExistsFile( sOriFile) then
bToProcess = false
EgtCopyFile( sOriFile, sNgeFile)
-- se cambiata configurazione macchina da ultima elaborazione, devo aggiornare
if EgtCompareFilesLastWriteTime( sOriFile, sMachDir .. '\\Wall\\TS3Data.lua') == -1 or
EgtCompareFilesLastWriteTime( sOriFile, sMachDir .. '\\Tools\\Tools.data') == -1 or
EgtCompareFilesLastWriteTime( sOriFile, sMachDir .. '\\' .. sMachine ..'.mlde') == -1 then
bToRecalc = true
end
end
-- Inizializzo contatori errori e avvisi
local nErrCnt = 0
local nWarnCnt = 0
-- Se da elaborare
if bToProcess then
EgtOutLog( ' +++ Processing Parts >>>')
-- Flag di pannello da creare
local bCreatePanel
-- Dimensioni del pannello ed elenco pareti
local dPanelLen
local dPanelWidth
local vWall = {}
-- flag per Nesting da Btl
local bNestingFromBtl = false
local nRawOutlineId = GDB_ID.NULL
-- Se necessario, apro il file Bwe **cb: se ~= 'create panel "**
if WALL.FLAG ~= 6 then
if not EgtOpenFile( WALL.FILE) then
WALL.ERR = 13
WALL.MSG = 'Error opening BWE file : ' .. WALL.FILE
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
-- faccio copia del file originale
EgtCopyFile( WALL.FILE, sOriFile)
-- Aggiorno eventuali dati ausiliari
--UpdateAuxData( sBtmFile)
-- Se già presente un gruppo di lavoro
if EgtGetFirstMachGroup() then
-- Barra già presente
bCreatePanel = false
-- Rendo corrente il gruppo di lavoro
EgtSetCurrMachGroup()
-- Area tavola
local b3Tab = EgtGetTableArea()
-- Calcolo posizione estremo TR della tavola rispetto a sua origine in BL
WD.OriTR = Point3d( b3Tab:getDimX(), b3Tab:getDimY(), 0)
-- altrimenti devo recuperare i pezzi per creare il pannello
else
-- Pannello da creare
bCreatePanel = true
-- Recupero l'elenco ordinato delle pareti
local nPartId = EgtGetFirstPart()
while nPartId do
table.insert( vWall, { Id = nPartId, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))})
nPartId = EgtGetNextPart( nPartId)
end
if #vWall == 0 then
WALL.ERR = 14
WALL.MSG = 'Error no beams in the file : ' .. WALL.FILE
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
else
local sOut = ''
for i = 1, #vWall do
sOut = sOut .. vWall[i].Name .. ', '
end
sOut = sOut:sub( 1, -3)
EgtOutLog( 'Pareti trovate : ' .. sOut, 1)
end
-- variabile che indica se ci sono fori orizzontali lunghi
local bUseMinRawYForLongDrill = false
-- recupero libreria fori
_G.package.loaded.WProcessDrill = nil
local Drill = require( 'WProcessDrill')
-- Ne recupero le dimensioni
for i = 1, #vWall do
local Ls = EgtGetFirstNameInGroup( vWall[i].Id, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
WALL.ERR = 15
WALL.MSG = 'Box undefined for wall ' .. vWall[i].Name
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
else
vWall[i].Box = b3Solid
end
-- recupero lista feature e ciclo
local vPartProc = WE.CollectFeatures( vWall[i].Id)
for nInd = 1, #vPartProc do
if Drill.Identify( vPartProc[nInd]) and Drill.UseMinYForLongDrill(vPartProc[nInd]) then
bUseMinRawYForLongDrill = true
end
end
end
-- se parete con fori lunghi orizzontali
local dMinY = 0
if bUseMinRawYForLongDrill then
-- considero minima larghezza per permettere di farli
dMinY = ( WD.MINRAWY_HOR_DRILL or 2800)
end
-- Assegno dimensioni del pannello
dPanelLen = vWall[1].Box:getDimX() + 20
dPanelWidth = math.max( vWall[1].Box:getDimY() + 20, dMinY)
-- Assegno posizione prima ed unica parete
vWall[1].PosX = 10
vWall[1].PosZ = 10
vWall[1].Rot = 0
vWall[1].Flip = 0
end
-- Altrimenti, opero sul progetto corrente
else
-- Recupero l'identificativo del gruppo di lavoro corrente
local nMGrpId = EgtGetCurrMachGroup()
-- Pannello da creare
bCreatePanel = true
-- leggo se grezzo da nesting btl
bNestingFromBtl = EgtGetInfo( nMGrpId, 'BTLNESTING', 'b') or false
if bNestingFromBtl then
-- recupero superficie
nRawOutlineId = EgtGetInfo( nMGrpId, 'RAWOUTLINEID') or GDB_ID.NULL
if nRawOutlineId ~= GDB_ID.NULL then
local nRawPartId = EgtGetParent( EgtGetParent( nRawOutlineId))
EgtSetStatus( nRawPartId, GDB_ST.ON)
local b3RawSurf = EgtGetBBoxGlob( nRawPartId, GDB_BB.STANDARD)
EgtSetStatus( nRawPartId, GDB_ST.OFF)
--EgtSurfTmBBox( nRawOutlineId, b3RawSurf, false, GDB_RT.GLOB)
if b3RawSurf then
-- Lunghezza e larghezza del pannello
dPanelLen = b3RawSurf:getDimX()
dPanelWidth = b3RawSurf:getDimY()
end
end
else
-- Lunghezza e larghezza del pannello
dPanelLen = EgtGetInfo( nMGrpId, 'PANELLEN', 'd')
dPanelWidth = EgtGetInfo( nMGrpId, 'PANELWIDTH', 'd')
end
-- Recupero l'elenco ordinato delle pareti da inserire nel pannello
for i = 1, 100 do
local sKey = 'PART'..tostring( i)
local sVal = EgtGetInfo( nMGrpId, sKey)
local vVal = EgtSplitString( sVal or '')
if not vVal or #vVal < 5 then break end
local nPartId = tonumber( vVal[1])
local dPosX = tonumber( vVal[2])
local dPosY = tonumber( vVal[3])
local dRot = tonumber( vVal[4])
local dFlip = tonumber( vVal[5])
table.insert( vWall, { Id = nPartId, PosX = dPosX, PosZ = dPosY, Rot = dRot, Flip = dFlip, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))})
end
if #vWall == 0 then
WALL.ERR = 14
WALL.MSG = 'Error : no walls in the project'
WriteErrToLogFile( WALL.ERR, WALL.MSG)
return
else
local sOut = ''
for i = 1, #vWall do
sOut = sOut .. vWall[i].Name .. ', '
end
sOut = sOut:sub( 1, -3)
EgtOutLog( 'Pareti trovate : ' .. sOut, 1)
end
-- Ne recupero le dimensioni
for i = 1, #vWall do
local Ls = EgtGetFirstNameInGroup( vWall[i].Id, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
WALL.ERR = 15
WALL.MSG = 'Box undefined for beam ' .. vWall[i].Name
WriteErrToLogFile( WALL.ERR, WALL.MSG)
return
else
vWall[i].Box = b3Solid
end
end
end
-- Se devo creare il pannello
if bCreatePanel then
-- Ne verifico le dimensioni
local dRawH = vWall[1].Box:getDimZ()
local vWallErr = {}
for i = 2, #vWall do
local dDimH = vWall[i].Box:getDimZ()
if abs( dDimH - dRawH) > 10 * GEO.EPS_SMALL then
table.insert( vWallErr, i)
end
end
if #vWallErr > 0 then
local sOut = 'Rimosse pareti con spessore diverso dalla prima :\n'
for i = #vWallErr, 1, -1 do
sOut = sOut .. vWall[vWallErr[i]].Name .. '\n'
table.remove( vWall, vWallErr[i])
end
ResetMachGroup( vWall)
WALL.ERR = 16
WALL.MSG = sOut
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
local dRawL = dPanelLen
local dRawW = dPanelWidth
-- Verifico dimensioni massime grezzo
if dRawL > WD.MAX_LENGTH + 10 * GEO.EPS_SMALL or dRawW > WD.MAX_WIDTH + 10 * GEO.EPS_SMALL or dRawH > WD.MAX_HEIGHT + 10 * GEO.EPS_SMALL then
ResetMachGroup( vWall)
local sOut = BWMessageId( 1, 'Grezzo (%s x %s x %s) oltre il limite della macchina (%s x %s x %s)',
{EgtNumToString( dRawL, 2), EgtNumToString( dRawW, 2), EgtNumToString( dRawH, 2),
EgtNumToString( WD.MAX_LENGTH, 2), EgtNumToString( WD.MAX_WIDTH, 2), EgtNumToString( WD.MAX_HEIGHT, 2)})
WALL.ERR = 17
WALL.MSG = sOut
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
-- Verifico dimensioni minime del grezzo
if dRawL < WD.MIN_LENGTH - 10 * GEO.EPS_SMALL or dRawW < WD.MIN_WIDTH - 10 * GEO.EPS_SMALL or dRawH < WD.MIN_HEIGHT - 10 * GEO.EPS_SMALL then
ResetMachGroup( vWall)
local sOut = 'Grezzo (' .. EgtNumToString( dRawL, 2) .. ' x ' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' ..
'sotto il limite della macchina ('..EgtNumToString( WD.MIN_LENGTH, 2)..' x '..EgtNumToString( WD.MIN_WIDTH, 2)..' x '..EgtNumToString( WD.MIN_HEIGHT, 2)..')'
WALL.ERR = 17
WALL.MSG = sOut
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
-- Sistemo le pareti nel grezzo
local bPbOk, sPbErr = WE.ProcessWalls( dRawL, dRawW, dRawH, vWall, WALL.FLAG == 6, true, nRawOutlineId)
if not bPbOk then
WALL.ERR = 18
WALL.MSG = sPbErr
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
else
-- Scrivo altezza grezzo nel gruppo di lavoro corrente
local nMGrpId = EgtGetCurrMachGroup()
EgtSetInfo( nMGrpId, 'PANELHEIGHT', dRawH)
end
-- altrimenti sistemo
else
-- recupero il grezzo
local nRawId = EgtGetFirstRawPart()
-- ciclo sui pezzi
local nPartId = EgtGetFirstPartInRawPart( nRawId)
while nPartId do
WL.CreateOrEmptyAddGroup( nPartId)
nPartId = EgtGetNextPartInRawPart( nPartId)
end
end
-- Se richiesta solo pannello, esco
if WALL.FLAG == 6 then
-- Completamento senza errori e avvisi
if nWarnCnt == 0 then
WALL.ERR = 0
WALL.MSG = '---'
WriteErrToLogFile( WALL.ERR, WALL.MSG)
end
EgtOutLog( ' +++ BatchProcess completed')
return
end
-- Imposto Nome file CN
local _, sName, _ = EgtSplitPath( WALL.FILE)
EgtSetInfo( EgtGetCurrMachGroup(), 'NcName', sName .. '.cnc')
-- Abilito Vmill
EgtSetInfo( EgtGetCurrMachGroup(), 'Vm', '1')
-- Aggiorno Setup utensili
EgtImportSetup()
-- Lavoro le features
local bPfOk, Stats = WE.ProcessFeatures()
local sOutput = ''
for i = 1, #Stats do
local sMsg = Stats[i].Msg
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 = '---'
WALL.ROT = Stats[i].Rot or 0
WALL.CUTID = Stats[i].CutId
WALL.TASKID = Stats[i].TaskId
WriteErrToLogFile( WALL.ERR, WALL.MSG, WALL.ROT, WALL.CUTID, WALL.TASKID)
elseif Stats[i].Err > 0 then
nErrCnt = nErrCnt + 1
sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg)
WALL.ERR = 19
WALL.MSG = sMsg
WALL.ROT = Stats[i].Rot or 0
WALL.CUTID = Stats[i].CutId
WALL.TASKID = Stats[i].TaskId
WriteErrToLogFile( WALL.ERR, WALL.MSG, WALL.ROT, WALL.CUTID, WALL.TASKID)
elseif Stats[i].Err < 0 then
nWarnCnt = nWarnCnt + 1
sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, sMsg)
WALL.ERR = -19
WALL.MSG = sMsg
WALL.ROT = Stats[i].Rot or 0
WALL.CUTID = Stats[i].CutId
WALL.TASKID = Stats[i].TaskId
WriteErrToLogFile( WALL.ERR, WALL.MSG, WALL.ROT, WALL.CUTID, WALL.TASKID)
end
end
-- Salvo il progetto
EgtSaveFile( sNgeFile)
-- copio come originale (per dichiarare progetto ricalcolato)
EgtCopyFile( sNgeFile, sOriFile)
-- Visualizzazione avvisi o errori
if #sOutput > 0 then EgtOutLog( sOutput) end
if nErrCnt > 0 then
PostErrView( 19, sOutput)
elseif nWarnCnt > 0 then
PostWarnView( 19, sOutput)
end
-- Altrimenti carico il progetto salvato e dichiaro nessun errore
else
EgtOutLog( ' +++ Loading Project already processed >>>')
-- Carico il progetto già fatto
EgtOpenFile( sNgeFile)
-- Dichiaro nessun errore
--local nPartId = EgtGetFirstPart()
--while nPartId do
-- local vDup = EgtDuploList( nPartId)
-- if not vDup or #vDup == 0 then
-- vDup = { nPartId}
-- end
-- for i = 1, #vDup do
-- local nCutId = EgtGetInfo( vDup[i], 'CUTID', 'i')
-- if nCutId then
-- local LayerId = {}
-- LayerId[1] = EgtGetFirstNameInGroup( vDup[i], 'Outline')
-- LayerId[2] = EgtGetFirstNameInGroup( vDup[i], 'Processings')
-- for nInd = 1, #LayerId do
-- local nProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL)
-- while nProcId do
-- local bIsFea = EgtExistsInfo( nProcId, 'GRP') and EgtExistsInfo( nProcId, 'PRC')
-- local nTaskId = EgtGetInfo( nProcId, 'TASKID', 'i')
-- if bIsFea and nTaskId then
-- WALL.ERR = 0
-- WALL.MSG = '---'
-- WALL.ROT = 0
-- WALL.CUTID = nCutId
-- WALL.TASKID = nTaskId
-- WriteErrToLogFile( WALL.ERR, WALL.MSG, WALL.ROT, WALL.CUTID, WALL.TASKID)
-- end
-- nProcId = EgtGetNext( nProcId)
-- end
-- end
-- end
-- end
-- nPartId = EgtGetNextPart( nPartId)
--end
-- Aggiorno eventuali dati ausiliari
--UpdateAuxData( sBtmFile)
-- Passo in modalità lavora
EgtSetCurrMachGroup( EgtGetLastMachGroup())
-- Se necessario eseguo aggiornamento con setup corrente e ricalcolo delle lavorazioni
if bToRecalc then
EgtOutLog( ' +++ Recalculating all dispositions and machinings >>>')
EgtImportSetup()
EgtApplyAllMachinings()
-- Salvo il progetto
EgtSaveFile( sNgeFile)
-- copio come originale (per dichiarare progetto ricalcolato)
EgtCopyFile( sNgeFile, sOriFile)
end
end
-- *** Eseguo simulazione con verifica collisione in cieco ***
if ( WALL.FLAG == 0 and ( bToProcess or bToRecalc)) or WALL.FLAG == 3 or WALL.FLAG == 4 then
EgtOutLog( ' +++ Simulating with collision check >>>')
-- verifico setup
local bSetUpOk, SetUpErrors = EgtVerifyCurrSetup()
if not bSetUpOk then
local sToolsList = ""
for ToolIndex = 1, #SetUpErrors do
sToolsList = sToolsList .. SetUpErrors[ToolIndex]
if ToolIndex ~= #SetUpErrors then
sToolsList = sToolsList .. ", "
end
end
WriteErrToLogFile( 19, 'Error in setup: tool/s ' .. sToolsList .. ' not found', 0, 0, 0)
return
end
-- lancio simulazione
local bSimOk, nErr, sErr = EgtSimulate()
if not bSimOk then
if nErr == MCH_SHE.INIT then
WALL.ERR = 19
WALL.MSG = 'Error starting simulation'
elseif nErr == MCH_SHE.COLLISION then
WALL.ERR = 22
WALL.MSG = 'Head-part collision'
elseif nErr == MCH_SHE.OUTSTROKE then
WALL.ERR = 23
WALL.MSG = 'Axis outstroke ' .. sErr
elseif nErr == MCH_SHE.SPECIAL then
WALL.ERR = 24
WALL.MSG = 'Special error ' .. sErr
else
WALL.ERR = 25
WALL.MSG = 'General failure (contact supplier)'
end
WALL.ROT = 0
WALL.CUTID = 0
WALL.TASKID = 0
local vItem = EgtSplitString( sErr, ';') or {}
for i = 1, #vItem do
vItem[i] = EgtTrim( vItem[i] or '')
if string.find( vItem[i], 'CUTID', 1, true) then
WALL.CUTID = EgtGetVal( vItem[i], 'CUTID', 'i') or 0
elseif string.find( vItem[i], 'TASKID', 1, true) then
WALL.TASKID = EgtGetVal( vItem[i], 'TASKID', 'i') or 0
end
end
WriteErrToLogFile( WALL.ERR, WALL.MSG, WALL.ROT, WALL.CUTID, WALL.TASKID)
return
end
end
-- *** Genero programma CN *** ( se richiesto)
if WALL.FLAG == 0 or WALL.FLAG == 4 then
EgtOutLog( ' +++ Generating NC part program >>>')
local sInfo = 'EgtCAM5 - '
if EgtGetExeVersion then
sInfo = 'EgtCAM5 ver.' .. EgtGetExeVersion() .. ' - '
end
if not EgtGenerate( '', sInfo .. sNgeFile) then
WALL.ERR = 20
local _, sName, _ = EgtSplitPath( WALL.FILE)
WALL.MSG = 'Error generating NC part program : ' .. sName
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
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
WriteErrToLogFile( WALL.ERR, WALL.MSG)
PostErrView( WALL.ERR, WALL.MSG)
return
end
local Ttot = EgtGetInfo( EgtGetCurrMachGroup(), 'Ttot', 'd')
local sTime = 'Total Time = ' .. EgtNumToString( Ttot, 1)
EgtOutLog( sTime)
-- 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 opportuna
if WALL.FLAG == 1 or WALL.FLAG == 2 then
local vView = { SCE_VD.ISO_NW, SCE_VD.ISO_SW, SCE_VD.ISO_NE, SCE_VD.ISO_SE}
local nV = min( max( WD.SIMUL_VIEW_DIR or 2, 1), 4)
EgtSetView( vView[nV], false)
-- se cloud, imposto la vista TOP
elseif WALL.FLAG == 5 then
EgtSetView( SCE_VD.TOP, false)
end
-- Completamento senza errori e avvisi
if nWarnCnt == 0 then
WALL.ERR = 0
WALL.MSG = '---'
WriteErrToLogFile( WALL.ERR, WALL.MSG)
end
-- Scrittura tempo totale stimato di lavorazione
WriteTimeToLogFile( Ttot)
EgtOutLog( ' +++ BatchProcess completed')
@@ -0,0 +1,48 @@
-- GetWallData.lua by Egaltech s.r.l. 2021/11/22
-- Recupero dati da file WallData.lua di macchina
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Per test
--GWD = {}
--GWD.MACHINE = 'Essetre-90480019_MW'
local sLog = 'GetWallData : ' .. GWD.MACHINE
EgtOutLog( sLog)
-- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Pareti
local sMachDir = EgtGetCurrMachineDir()
if not EgtExistsFile( sMachDir .. '\\Wall\\WallData.lua') then
GWD.ERR = 12
GWD.MSG = 'Error not configured for walls machine : ' .. GWD.MACHINE
WriteErrToLogFile( GWD.ERR, GWD.MSG)
PostErrView( GWD.ERR, GWD.MSG)
return
end
-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie
EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Wall\\?.lua')
-- Carico i dati globali
local WD = require( 'WallData')
-- Assegno valori di interesse
GWD.SIMUL_VIEW_DIR = WD.SIMUL_VIEW_DIR
GWD.ORIG_CORNER = WD.ORIG_CORNER
GWD.NESTING_CORNER = WD.NESTING_CORNER
GWD.HOR_DRILL_DIAM = WD.HOR_DRILL_DIAM
GWD.MIN_HEIGHT = WD.MIN_HEIGHT
GWD.MAX_HEIGHT = WD.MAX_HEIGHT
-- Tutto ok
GWD.ERR = 0
EgtOutLog( ' +++ GetWallData completed')
Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

@@ -0,0 +1,181 @@
-- MachiningLib.lua by Egaltech s.r.l. 2022/01/12
-- Libreria ricerca lavorazioni per Pareti
-- Tabella per definizione modulo
local WMachiningLib = {}
-- Include
require( 'EgtBase')
EgtOutLog( ' WMachiningLib started', 1)
-- Dati
local WD = require( 'WallData')
local Cuttings = require( 'CutData')
local Millings = require( 'MillingData')
local Pocketings = require( 'PocketingData')
local Sawings = require( 'SawingData')
local Drillings = require( 'DrillData')
local Surfacings
if EgtExistsFile( EgtGetCurrMachineDir() .. '\\Wall\\SurfacingData.lua') then
Surfacings = require( 'SurfacingData')
end
---------------------------------------------------------------------
local function SetCurrMachiningAndTool( sMachName)
if not EgtMdbSetCurrMachining( sMachName) then return false end
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
local sTool = EgtTdbGetToolFromUUID( sTuuid)
if not sTool then return false end
if not EgtTdbSetCurrTool( sTool) then return false end
return EgtTdbGetCurrToolParam( MCH_TP.ACTIVE)
end
---------------------------------------------------------------------
function WMachiningLib.FindCutting( sType, dDepth, nTool_ID)
for i = 1, #Cuttings do
local Cutting = Cuttings[i]
if Cutting.On and Cutting.Type == sType and SetCurrMachiningAndTool( Cutting.Name) then
local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE)
local dSawDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or 0
local dSawThick = EgtTdbGetCurrToolParam( MCH_TP.THICK) or 0
local dSawMaxDepth = EgtTdbGetCurrToolMaxDepth() or 0
local nMyTool_ID = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'Tool_ID', 'i')
if nMchType == MCH_MY.SAWING and
( not dDepth or dSawMaxDepth > dDepth - 10 * GEO.EPS_SMALL) and
( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) then
return Cutting.Name, dSawDiam, dSawThick, dSawMaxDepth
end
end
end
end
---------------------------------------------------------------------
function WMachiningLib.FindMilling( sType, dDepth, sTuuid, nTool_ID, dMaxDiam, dMaxMat, bTipFeed, dMinSideElev)
for i = 1, #Millings do
local Milling = Millings[i]
if Milling.On and Milling.Type == sType and SetCurrMachiningAndTool( Milling.Name) then
local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE)
local sMyTuuid = EgtGetMachiningParam( MCH_MP.TUUID)
local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, dTMaxMat, EgtTdbGetCurrToolMaxDepth())
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTDiamTh = EgtTdbGetCurrToolThDiam() or 0
local dTTipFeed = EgtTdbGetCurrToolParam( MCH_TP.TIPFEED)
local dTMaxDepthOnSide = min( EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'SIDEDEPTH', 'd') or 0, 0.5 * ( dTDiam - dTDiamTh))
local nMyTool_ID = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'Tool_ID', 'i')
if nMchType == MCH_MY.MILLING and
( not sTuuid or sTuuid == sMyTuuid) and
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
( not dMaxMat or dTMaxMat < dMaxMat + GEO.EPS_SMALL) and
( not bTipFeed or dTTipFeed > 1) and
( not dMinSideElev or dTMaxDepthOnSide > dMinSideElev - GEO.EPS_SMALL) and
( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) then
return Milling.Name, dTMaxDepth, dTMaxMat, dTDiam
end
end
end
end
---------------------------------------------------------------------
function WMachiningLib.FindNailing( nType)
for i = 1, #Millings do
local Milling = Millings[i]
if Milling.On and Milling.Type == 'Nailing' and SetCurrMachiningAndTool( Milling.Name) then
local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE)
local sTName = EgtTdbGetCurrToolParam( MCH_TP.NAME)
if nMchType == MCH_MY.MILLING and
sTName == tostring( nType) then
return Milling.Name
end
end
end
end
---------------------------------------------------------------------
function WMachiningLib.FindPocketing( sType, dMaxDiam, dDepth, nTool_ID)
for i = 1, #Pocketings do
local Pocketing = Pocketings[i]
if Pocketing.On and Pocketing.Type == sType and SetCurrMachiningAndTool( Pocketing.Name) then
local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), EgtTdbGetCurrToolMaxDepth())
local nMyTool_ID = EgtTdbGetCurrToolValInNotes( MCH_TP.USERNOTES, 'Tool_ID', 'i')
if nMchType == MCH_MY.POCKETING and
( not dMaxDiam or dTDiam < dMaxDiam + GEO.EPS_SMALL) and
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
( not nTool_ID or nTool_ID == 0 or nTool_ID == nMyTool_ID) then
return Pocketing.Name, dTDiam, dTMaxDepth
end
end
end
end
---------------------------------------------------------------------
function WMachiningLib.FindSawing( sType)
for i = 1, #Sawings do
local Sawing = Sawings[i]
if Sawing.On and Sawing.Type == sType and SetCurrMachiningAndTool( Sawing.Name) then
local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE)
if nMchType == MCH_MY.MORTISING then
return Sawing.Name
end
end
end
end
---------------------------------------------------------------------
function WMachiningLib.FindDrilling( dDiam, dDepth, sHead, bOnlyPockets)
if bOnlyPockets == nil or not bOnlyPockets then
-- ricerca sulle forature, dal diametro maggiore al minore
for i = #Drillings, 1, -1 do
local Drilling = Drillings[i]
if Drilling.On and Drilling.Type == 'Drill' and SetCurrMachiningAndTool( Drilling.Name) then
local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
local sMyHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
if nMchType == MCH_MY.DRILLING and
dTDiam < dDiam + 10 * GEO.EPS_SMALL and dTDiam > dDiam - WD.DRILL_TOL - 10 * GEO.EPS_SMALL and
( not dDepth or dTMaxMat > dDepth - GEO.EPS_SMALL) and
(( not sHead and sMyHead ~= 'H5' and sMyHead ~= 'H6') or sHead == sMyHead) then
return Drilling.Name, Drilling.Type, dTMaxMat
end
end
end
end
-- ricerca sulle svuotature, dal diametro maggiore al minore
for i = #Drillings, 1, -1 do
local Drilling = Drillings[i]
if Drilling.On and Drilling.Type == 'Pocket' and SetCurrMachiningAndTool( Drilling.Name) then
local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE)
local dTDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dTMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT), EgtTdbGetCurrToolMaxDepth())
local sMyHead = EgtTdbGetCurrToolParam( MCH_TP.HEAD)
if nMchType == MCH_MY.POCKETING and
dTDiam < dDiam - 10 * GEO.EPS_SMALL and
( not dDepth or dTMaxDepth > dDepth - GEO.EPS_SMALL) and
( ( not sHead and sMyHead ~= 'H5' and sMyHead ~= 'H6') or sHead == sMyHead) then
return Drilling.Name, Drilling.Type, dTMaxDepth
end
end
end
end
---------------------------------------------------------------------
function WMachiningLib.FindSurfacing( sType)
if not Surfacings then return end
for i = 1, #Surfacings do
local Surfacing = Surfacings[i]
if Surfacing.On and Surfacing.Type == sType and SetCurrMachiningAndTool( Surfacing.Name) then
local nMchType = EgtMdbGetCurrMachiningParam( MCH_MP.TYPE)
if nMchType == MCH_MY.SURFFINISHING then
return Surfacing.Name
end
end
end
end
-------------------------------------------------------------------------------------------------------------
return WMachiningLib
@@ -0,0 +1,74 @@
-- WProcessCut.lua by Egaltech s.r.l. 2020/11/13
-- 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 vtN:getZ() < - 0.5 then return false end
return true
end
----------------------------------------------------------------------
-- Classificazione del flip della feature per nesting
-- return nFlip0, nFlip1
function WPC.FlipClassify( Proc)
-- verifico abbia una sola faccia
if Proc.Fct ~= 1 then return 0, 0 end
-- controllo la normale
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
local vtNZ = vtN:getZ()
if vtNZ > - GEO.EPS_SMALL then
nFlip0 = 100
elseif vtNZ < -0.5 then
nFlip0 = 0
else
nFlip0 = 50
end
if - vtNZ > - GEO.EPS_SMALL then
nFlip1 = 100
elseif - vtNZ < -0.5 then
nFlip1 = 0
else
nFlip1 = 50
end
--nFlip0 = EgtIf( vtN:getZ() < -0.5, 0, 100)
--nFlip1 = EgtIf( - vtN:getZ() < -0.5, 0, 100)
return nFlip0, nFlip1
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function WPC.Make( Proc, nRawId, b3Raw)
return FreeContour.Make( Proc, nRawId, b3Raw)
end
---------------------------------------------------------------------
return WPC
@@ -0,0 +1,65 @@
-- WProcessDoubleCut.lua by Egaltech s.r.l. 2021/04/28
-- Gestione calcolo doppi tagli di lama per Pareti
-- Tabella per definizione modulo
local WPDC = {}
-- Include
require( 'EgtBase')
local WL = require( 'WallLib')
local Cut = require( 'WProcessCut')
local LapJoint = require( 'WProcessLapJoint')
EgtOutLog( ' WProcessDoubleCut started', 1)
-- Dati
local WD = require( 'WallData')
local ML = require( 'WMachiningLib')
---------------------------------------------------------------------
-- Riconoscimento della feature
function WPDC.Identify( Proc)
return ( (( Proc.Grp == 1 or Proc.Grp == 2) and Proc.Prc == 11) or
( Proc.Grp == 0 and Proc.Prc == 12))
end
---------------------------------------------------------------------
-- Classificazione della feature
function WPDC.Classify( Proc, b3Raw)
-- se una faccia, uso la classificazione dei tagli singoli
if Proc.Fct == 1 then return Cut.Classify( Proc, b3Raw) end
-- se più di due facce non si fa
if Proc.Fct > 2 then return false end
-- dati delle facce
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 o di fianco
return ( vtN[1]:getZ() >= - 0.01 or vtN[2]:getZ() >= - 0.01)
end
----------------------------------------------------------------------
-- Classificazione del flip della feature per nesting
-- return nFlip0, nFlip1
function WPDC.FlipClassify( Proc)
-- se una faccia, uso la classificazione dei tagli singoli
if Proc.Fct == 1 then return Cut.FlipClassify( Proc) end
-- se due facce, uso la classificazione del lap joint a due facce
if Proc.Fct == 2 then return LapJoint.FlipClassify( Proc) end
-- se più di due facce non si fa
if Proc.Fct > 2 then return 0, 0 end
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function WPDC.Make( Proc, nRawId, b3Raw)
-- se singola faccia, passo a quella lavorazione
if Proc.Fct == 1 then return Cut.Make( Proc, nRawId, b3Raw) end
-- altrimenti due facce e passo alla LapJoint
return LapJoint.Make( Proc, nRawId, b3Raw)
end
---------------------------------------------------------------------
return WPDC
@@ -0,0 +1,544 @@
-- WProcessDrill.lua by Egaltech s.r.l. 2022/03/08
-- Gestione calcolo forature per Pareti
-- 2021/08/29 DS Se foratura di fianco setto flag per farla dopo i tagli.
-- 2021/12/04 DS Modifiche per forature speciali lungo Y.
-- 2022/01/12 DS Se con fresatura richiedo che l'utensile possa lavorare di testa.
-- 2022/01/19 DS Forature orizzontali lunghe con nome LhDrill_.
-- 2022/01/20 DS Aggiunta gestione Q01 (flag forzatura solo contornatura).
-- 2022/01/29 DS Corretta gestione ingombro portautensili per fori inclinati da sopra.
-- 2022/02/22 ES Aggiunta gestione prefori.
-- 2022/03/08 DS Vanno accettati fori orizzontali sul bordo anche senza foratori orizzontali speciali.
-- Tabella per definizione modulo
local WPD = {}
-- Include
require( 'EgtBase')
local WL = require( 'WallLib')
EgtOutLog( ' WProcessDrill started', 1)
-- Dati
local WD = require( 'WallData')
local WM = require( 'WMachiningLib')
-- Parametri Q
local sContourOnly = 'Q01' -- 0=no, 1=si
---------------------------------------------------------------------
-- Riconoscimento della feature
function WPD.Identify( Proc)
return ( ( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 40)
end
---------------------------------------------------------------------
-- Recupero dati foro e adattamento se speciale
function WPD.GetData( Proc)
-- verifico se foro da adattare
if EgtExistsInfo( Proc.Id, 'DiamUser') then
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + Proc.Id end
if AuxId and EgtGetType( AuxId) == GDB_TY.CRV_ARC and WD.USER_HOLE_DIAM and WD.USER_HOLE_DIAM > 1 then
EgtModifyArcRadius( AuxId, WD.USER_HOLE_DIAM / 2)
EgtSetInfo( Proc.Id, 'P12', WD.USER_HOLE_DIAM)
end
end
-- recupero diametro
local dDiam = EgtGetInfo( Proc.Id, 'P12', 'd') or 0
-- recupero faccia di entrata e uscita
local nFcs = EgtGetInfo( Proc.Id, 'FCS', 'i') or 0
local nFce = EgtGetInfo( Proc.Id, 'FCE', 'i') or 0
return dDiam, nFcs, nFce
end
---------------------------------------------------------------------
-- Classificazione della feature
function WPD.Classify( Proc, b3Raw)
-- recupero e verifico l'entità foro
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then
return false
end
-- recupero i dati del foro
local dDiam = 2 * EgtArcRadius( AuxId)
local dLen = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local ptCen = EgtCP( AuxId, GDB_RT.GLOB)
local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0)
-- se inizia o finisce sulla faccia sopra
if ptCen:getZ() > b3Raw:getMax():getZ() - dDiam / 2 or ( bOpen and ptCen:getZ() - vtExtr:getZ() * dLen > b3Raw:getMax():getZ() - dDiam / 2) then
-- è lavorabile se non troppo inclinato
return ( abs( vtExtr:getZ()) >= WD.DRILL_VZ_MIN)
end
-- se con direzione asse Y e macchina con foratore orizzontale del giusto diametro
if WD.HOR_DRILL_DIAM and abs( dDiam - WD.HOR_DRILL_DIAM) < WD.DRILL_TOL and AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) then
return true
end
-- se foro orizzontale, verifico sia sul bordo del grezzo
local b3RedRaw = BBox3d( b3Raw)
b3RedRaw:expand( -20)
if ( WD.HOR_DRILL_5AX or WD.HOR_DRILL_5AX == nil) and vtExtr:getZ() > -0.05 and not EnclosesPointXY( b3RedRaw, ptCen) then
return true
end
-- altrimenti non lavorabile
return false
end
---------------------------------------------------------------------
-- Classificazione del flip della feature per nesting
-- return nFlip0, nFlip1
function WPD.FlipClassify( Proc, b3Part)
-- recupero e verifico l'entità foro
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then
return false
end
-- recupero i dati del foro
local dDiam = 2 * EgtArcRadius( AuxId)
local dLen = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local ptCen = EgtCP( AuxId, GDB_RT.GLOB)
-- se foro cieco
if Proc.Fcs == 0 or Proc.Fce == 0 then
-- se normale positiva
local dVtExtrZ = vtExtr:getZ()
-- verifico se è lavorabile da sopra
local nFlip0 = EgtIf( dVtExtrZ >= WD.DRILL_VZ_MIN, 100, 0)
-- verifico se e' lavorabile da flipped: cambio segno al versore
local nFlip1 = EgtIf( -dVtExtrZ >= WD.DRILL_VZ_MIN, 100, 0)
return nFlip0, nFlip1
end
-- altrimenti
return 0, 0
end
---------------------------------------------------------------------
-- Classificazione della rotazione della feature per nesting
-- return nRot0, nRot90, nRot180, nRot270
function WPD.RotateClassify( Proc)
local nRot0 = -1
local nRot90 = -1
local nRot180 = -1
local nRot270 = -1
-- recupero e verifico l'entità foro
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then
return false
end
-- recupero i dati del foro
local dDiam = 2 * EgtArcRadius( AuxId)
local dLen = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local ptCen = EgtCP( AuxId, GDB_RT.GLOB)
-- se foro orizzontale con punta lunga
if dDiam <= WD.HOR_DRILL_DIAM + WD.DRILL_TOL and dDiam >= WD.HOR_DRILL_DIAM - WD.DRILL_TOL and vtExtr:getZ() > -0.1 and vtExtr:getZ() < 0.1 then
-- se orientato perpendicolare ad X
if AreSameOrOppositeVectorApprox( vtExtr, X_AX()) then
nRot0 = 0
nRot90 = 100
nRot180 = 0
nRot270 = 100
return nRot0, nRot90, nRot180, nRot270
elseif AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) then
nRot0 = 100
nRot90 = 0
nRot180 = 100
nRot270 = 0
return nRot0, nRot90, nRot180, nRot270
end
end
end
---------------------------------------------------------------------
local function IsHorizLongDrill( Proc)
-- recupero e verifico l'entità foro
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then
return false
end
-- recupero i dati del foro
local dDiam = 2 * EgtArcRadius( AuxId)
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
return dDiam <= WD.HOR_DRILL_DIAM + WD.DRILL_TOL and dDiam >= WD.HOR_DRILL_DIAM - WD.DRILL_TOL and vtExtr:getZ() > -0.1 and vtExtr:getZ() < 0.1
end
---------------------------------------------------------------------
function WPD.UseMinYForLongDrill( Proc)
if IsHorizLongDrill( Proc) then
-- recupero e verifico l'entità foro
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then
return false
end
-- recupero i dati del foro
local dDiam = 2 * EgtArcRadius( AuxId)
local dLen = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local ptCen = EgtCP( AuxId, GDB_RT.GLOB)
local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0)
-- se foro lungo orizzontale e piu' lungo della punta o orientato in Y-
if dDiam <= WD.HOR_DRILL_DIAM + WD.DRILL_TOL and dDiam >= WD.HOR_DRILL_DIAM - WD.DRILL_TOL and vtExtr:getZ() > -0.1 and vtExtr:getZ() < 0.1 and
( (bOpen and dLen > WD.HOR_DRILL_LEN) or ( not bOpen and vtExtr:getY() < 0)) then
return true
end
end
return false
end
---------------------------------------------------------------------
-- Verifica se da lavorare in due metà
function WPD.Split( Proc, b3Raw)
-- recupero e verifico l'entità foro
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then
return false
end
-- recupero i dati del foro
local dDiam = 2 * EgtArcRadius( AuxId)
local dLen = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0)
-- verifico se foro orizzontale in Y da lavorare in due metà
if WD.HOR_DRILL_Y_SPLIT and bOpen and AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) and
Proc.Box:getMin():getY() < WD.HOR_DRILL_Y_SPLIT - 10 and Proc.Box:getMax():getY() > WD.HOR_DRILL_Y_SPLIT + 10 then
return true
else
return false
end
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function WPD.Make( Proc, nRawId, b3Raw)
-- recupero e verifico l'entità foro
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i') or 0
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or EgtGetType( AuxId) ~= GDB_TY.CRV_ARC then
local sErr = 'Error : missing drill geometry'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati del foro
local dDiam = 2 * EgtArcRadius( AuxId)
local dLen = abs( EgtCurveThickness( AuxId))
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local ptCen = EgtCP( AuxId, GDB_RT.GLOB)
local bOpen = ( Proc.Fcs ~= 0 and Proc.Fce ~= 0)
-- verifico che il foro non sia fattibile solo da sotto
local bToInvert = ( vtExtr:getZ() < -0.1)
if bToInvert and ( not bOpen or Proc.Flg ~= 1) then
local sErr = 'Error : drilling from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- se foro da fare dall'altra parte forzo inversione
if Proc.Flg == -2 then bToInvert = true end
-- se foro chiuso sulla partenza forzo inversione
if Proc.Fcs == 0 then bToInvert = true end
-- se richiesta inversione, inverto versore di riferimento
if bToInvert then vtExtr = - vtExtr end
-- recupero la lavorazione (foratura/svuotatura)
local sHead
if WD.HOR_DRILL_Y_SPLIT and AreSameOrOppositeVectorApprox( vtExtr, Y_AX()) then
local dExtrY = vtExtr:getY()
if not bOpen or abs( Proc.Flg) == 2 then
sHead = EgtIf( dExtrY > 0, 'H5', 'H6')
else
if Proc.Box:getMax():getY() > WD.HOR_DRILL_Y_SPLIT + 10 then
sHead = 'H5'
if vtExtr:getY() < 0 then bToInvert = true end
else
sHead = 'H6'
if vtExtr:getY() > 0 then bToInvert = true end
end
end
end
local sDrilling, nType = WM.FindDrilling( dDiam, dLen, sHead)
if not sDrilling then
sDrilling, nType = WM.FindDrilling( dDiam, nil, sHead)
end
if sHead and not sDrilling then
sDrilling, nType = WM.FindDrilling( dDiam, dLen)
if not sDrilling then
sDrilling, nType = WM.FindDrilling( dDiam)
end
if sDrilling then sHead = '' end
end
local bAngledContourDrill = false
local nAngledContourDrillId = GDB_ID.NULL
local dReduceDepth = 0
-- se trovata svuotatura, verifico se richiesta invece contornatura
if nType == 'Pocket' then
-- recupero eventuale flag per fare sola contornatura
local nContourOnly = ( EgtGetInfo( Proc.Id, sContourOnly, 'i') or 0)
if nContourOnly == 1 then
-- imposto riduzione profondita' per evitare distacco pezzo interno
dReduceDepth = 5
-- se inclinato e passante
if abs( vtExtr:getZ()) >= WD.DRILL_VZ_MIN and abs( vtExtr:getZ()) < 0.999 and Proc.Fcs > 0 and Proc.Fce > 0 then
-- gruppo ausiliario per preforo
local nAddGrpId = WL.GetAddGroup( Proc.PartId)
-- ricavo contorno inferiore della superficie
local nAngledCircleId, nAngledCircleCnt = EgtExtractSurfTmLoops( Proc.Id, nAddGrpId)
local dMinZ = 10000
local nMinCircleId = GDB_ID.NULL
for Circleindex = 1, nAngledCircleCnt do
local b3Circle = EgtGetBBoxGlob( nAngledCircleId + Circleindex -1, GDB_BB.EXACT)
if b3Circle:getMin():getZ() < dMinZ then
nMinCircleId = nAngledCircleId + Circleindex -1
end
end
-- estrudo
EgtModifyCurveExtrusion( nMinCircleId, vtExtr, GDB_RT.GLOB)
EgtModifyCurveThickness( nMinCircleId, dLen)
bAngledContourDrill = true
nAngledContourDrillId = nMinCircleId
end
sDrilling = WM.FindMilling( 'FreeContour', dLen, nil, nil, nil, nil, true)
if sDrilling then
nType = 'Mill'
sHead = ''
end
end
end
if not sDrilling then
local sErr = 'Error : drilling not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- controllo posizione Y inizio foro con testa H6
if WD.HOR_DRILL_YNEG_MAXMIN and sHead == 'H6' then
if b3Raw:getMin():getY() > WD.HOR_DRILL_YNEG_MAXMIN then
local sErr = 'Error : horizontal hole with Drilling2 starting too far'
EgtOutLog( sErr)
return false, sErr
end
end
-- recupero i dati dell'utensile
local dMaxDepth = 20
local dFreeLen = 20
local dDiamTh = 35
local dDiamT = 35
if EgtMdbSetCurrMachining( sDrilling) then
local bIsDrilling = ( EgtMdbGetCurrMachiningParam( MCH_MP.TYPE) == MCH_MY.DRILLING)
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
if bIsDrilling then
dFreeLen = EgtTdbGetCurrToolParam( MCH_TP.LEN) - EgtTdbGetCurrToolThLength() - EgtMdbGetGeneralParam( MCH_GP.MAXDEPTHSAFE)
dMaxDepth = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxDepth
else
dFreeLen = EgtTdbGetCurrToolMaxDepth() or dFreeLen
dMaxDepth = EgtIf( WD.MILL_MAX_DEPTH_AS_MAT, EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxDepth, dFreeLen)
end
dDiamTh = EgtTdbGetCurrToolThDiam()
dDiamT = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dDiamT
end
end
-- calcolo riduzione lunghezza aggiuntiva per inclinazione utensile
if bAngledContourDrill then
local dToolAngleReduce = ( dDiamT / 2) * sqrt( 1 - vtExtr:getZ() * vtExtr:getZ()) / vtExtr:getZ()
dReduceDepth = ( dToolAngleReduce) + ( 5 / vtExtr:getZ())
end
-- aggiusto massimo affondamento per fori lungo Y con teste speciali
if sHead == 'H5' then
local dMaxY = WD.HOR_DRILL_Y_SPLIT + WD.HOR_DRILL_Y_TABLE / 2
local dDeltaY = dMaxY - Proc.Box:getMax():getY()
if dDeltaY > 0 then
dMaxDepth = dMaxDepth - dDeltaY
end
elseif sHead == 'H6' then
local dMinY = WD.HOR_DRILL_Y_SPLIT - WD.HOR_DRILL_Y_TABLE / 2
local dDeltaY = Proc.Box:getMin():getY() - dMinY
if dDeltaY > 0 then
dMaxDepth = dMaxDepth - dDeltaY
end
end
-- se foro faccia sopra, limito il massimo affondamento secondo inclinazione
if ptCen:getZ() > b3Raw:getMax():getZ() - dDiam / 2 then
local SinA = abs( vtExtr:getZ())
if SinA >= WD.DRILL_VZ_MIN then
local CosA = sqrt( 1 - SinA * SinA)
local dSlantFreeLen = dFreeLen - ( dDiamTh / 2 * CosA / SinA)
dMaxDepth = min( dMaxDepth, dSlantFreeLen)
else
dMaxDepth = 0
end
end
-- inserisco la lavorazione
local sName = EgtIf( sHead == 'H5' or sHead == 'H6', 'LhDrill_', 'Drill_') .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sDrilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sDrilling
EgtOutLog( sErr)
return false, sErr
end
EgtSetInfo( nMchId, 'Part', Proc.PartId)
-- se foratura di fianco setto la nota per spostarla dopo i tagli di lama
if vtExtr:getZ() < WD.NZ_MINA and not sHead then
EgtSetInfo( nMchId, 'MOVE_AFTER', 1)
end
-- aggiungo geometria
if bAngledContourDrill then
EgtSetMachiningGeometry( nAngledContourDrillId)
else
EgtSetMachiningGeometry( {{ AuxId, -1}})
end
-- eventuale inversione
if nType == 'Drill' then
EgtSetMachiningParam( MCH_MP.INVERT, bToInvert)
else
EgtSetMachiningParam( MCH_MP.TOOLINVERT, bToInvert)
end
-- se fresatura gestisco il lato di lavoro
if bAngledContourDrill then
local nWorkSide = EgtGetMachiningParam( MCH_MP.WORKSIDE)
if nWorkSide == MCH_MILL_WS.CENTER then
nWorkSide = MCH_MILL_WS.RIGHT
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
end
EgtSetMachiningParam( MCH_MP.INVERT, nWorkSide == MCH_MILL_WS.LEFT)
elseif nType == 'Mill' then
local frRef = EgtGetGlobFrame( AuxId)
local vtNa, _, dArea = EgtCurveArea( AuxId)
vtNa:toGlob( frRef)
if vtNa:getZ() * dArea > 0 then
EgtSetMachiningParam( MCH_MP.INVERT, true)
else
EgtSetMachiningParam( MCH_MP.INVERT, false)
end
EgtSetMachiningParam( MCH_MP.WORKSIDE, MCH_MILL_WS.RIGHT)
end
-- per fori lungo Y con teste speciali aggiusto eventuale parte prima del foro ma nel grezzo
if sHead == 'H5' then
local dSafeStart = b3Raw:getMax():getY() - Proc.Box:getMax():getY() + 10
if dSafeStart > 20 then
EgtSetMachiningParam( MCH_MP.STARTPOS, dSafeStart)
end
elseif sHead == 'H6' then
local dSafeStart = Proc.Box:getMin():getY() - b3Raw:getMin():getY() + 10
if dSafeStart > 20 then
EgtSetMachiningParam( MCH_MP.STARTPOS, dSafeStart)
end
end
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_ZP
if AreSameOrOppositeVectorApprox( vtExtr, Z_AX()) then
nSCC = MCH_SCC.ADIR_YP
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- aggiusto l'affondamento
local sMyWarn
local dDepth = dLen - dReduceDepth
if dDepth > dMaxDepth + 10 * GEO.EPS_SMALL then
dDepth = dMaxDepth
if abs( Proc.Flg) ~= 2 then
sMyWarn = 'Warning in drill : depth (' .. EgtNumToString( dLen, 1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth, 1) .. ')'
EgtOutLog( sMyWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
end
end
EgtSetMachiningParam( MCH_MP.DEPTH, dDepth)
-- Note utente
local sUserNotes = ''
-- se foratura o svuotatura, dichiarazione nessuna generazione sfridi per Vmill
if nType == 'Drill' or nType == 'Pocket' then
sUserNotes = 'VMRS=0;'
end
-- se foratura
if nType == 'Drill' then
-- aggiungo alle note massima elevazione (coincide con affondamento)
sUserNotes = sUserNotes .. 'MaxElev=' .. EgtNumToString( dDepth, 1) .. ';'
-- se foro passante, aggiungo questa qualifica alle note
if bOpen then
sUserNotes = sUserNotes .. 'Open=1;'
end
end
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
local _, sWarn = EgtGetMachMgrWarning( 0)
if EgtIsMachiningEmpty() then
EgtSetOperationMode( nMchId, false)
return false, sWarn
else
sMyWarn = (sMyWarn or sWarn)
end
end
-- se preforo inclinato impostato, inclinazione oltre limite impostato e foro non orizzontale
if WD.PREDRILL_DIAM and WD.PREDRILL_DIAM > 0 and vtExtr:getZ() < ( WD.PREDRILL_MINANGLE or 0.707) and vtExtr:getZ() > 0.1 then
-- gruppo ausiliario per preforo
local nAddGrpId = WL.GetAddGroup( Proc.PartId)
-- calcolo profondita' foro
local dLen = ( WD.PREDRILL_DIAM / 2) * sqrt( 1 - vtExtr:getZ() * vtExtr:getZ()) / vtExtr:getZ()
-- copio foro originale
local nPreHoleId = EgtCopyGlob( AuxId, nAddGrpId)
EgtModifyArcRadius( nPreHoleId, WD.PREDRILL_DIAM / 2)
EgtModifyCurveThickness( nPreHoleId, -dLen) --dLen = 10
-- se da invertire
if bToInvert then
-- lo sposto della lunghezza d'estrusione e ne inverto il versore
local dThickness = EgtCurveThickness( AuxId)
EgtMove( nPreHoleId, abs( dThickness) * vtExtr, GDB_RT.GLOB)
EgtModifyCurveExtrusion( nPreHoleId, vtExtr, GDB_RT.GLOB)
end
-- recupero lavorazione di pocket
local sDrilling = WM.FindDrilling( WD.PREDRILL_DIAM, dLen, nil, true) --dLen = 10
if not sDrilling then
local sErr = 'Error : prehole pocket not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione
local sName = 'PreDrill_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchId = EgtAddMachining( sName, sDrilling)
if not nMchId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sDrilling
EgtOutLog( sErr)
return false, sErr
end
EgtSetInfo( nMchId, 'Part', Proc.PartId)
-- setto la nota per spostarla prima della foratura
EgtSetInfo( nMchId, 'MOVE_BEFORE', 1)
-- aggiungo geometria
EgtSetMachiningGeometry( {{ nPreHoleId, -1}})
-- note utente, dichiarazione nessuna generazione sfridi per Vmill
local sUserNotes = 'VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchId, false)
return false, sErr
else
local _, sWarn = EgtGetMachMgrWarning( 0)
if EgtIsMachiningEmpty() then
EgtSetOperationMode( nMchId, false)
return false, sWarn
else
sMyWarn = (sMyWarn or sWarn)
end
end
end
return true, sMyWarn
end
---------------------------------------------------------------------
return WPD
@@ -0,0 +1,220 @@
-- WProcessDtMortise.lua by Egaltech s.r.l. 2021/04/20
-- Gestione calcolo mortase a coda di rondine per Pareti
-- Tabella per definizione modulo
local WPDM= {}
-- Include
require( 'EgtBase')
local WL = require( 'WallLib')
EgtOutLog( ' WProcessDtMortise started', 1)
-- Dati
local WD = require( 'WallData')
local WM = require( 'WMachiningLib')
-- settaggi interni ( poi andrà utilizzato parametro ACTIVE_AS proveniente da parametri utente di TechnoEssetre)
local bMakeAntiSplitPath = true
local bMakeAsByArc = true
---------------------------------------------------------------------
-- Riconoscimento della feature
function WPDM.Identify( Proc)
return ( (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 55))
end
---------------------------------------------------------------------
-- Classificazione della feature
function WPDM.Classify( Proc, b3Raw)
-- recupero i dati della curva di contorno della faccia di fondo
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if not AuxId then return false end
AuxId = AuxId + Proc.Id
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
-- verifico se la mortasa è lavorabile
return ( vtExtr:getZ() > WD.NZ_MINA)
end
----------------------------------------------------------------------
-- Classificazione del flip della feature per nesting
-- return nFlip0, nFlip1
function WPDM.FlipClassify( Proc)
-- recupero i dati della curva di contorno della faccia di fondo
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if not AuxId then return false end
AuxId = AuxId + Proc.Id
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
-- verifico se la mortasa è lavorabile
nFlip0 = EgtIf( vtExtr:getZ() > WD.NZ_MINA, 100, 0)
nFlip1 = EgtIf( - vtExtr:getZ() > WD.NZ_MINA, 100, 0)
return nFlip0, nFlip1
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function WPDM.Make( Proc, nRawId, b3Raw)
-- recupero e verifico l'entità curva
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
local sErr = 'Missing profile geometry : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati della curva
local vtExtr = EgtCurveExtrusion( AuxId, GDB_RT.GLOB)
local ptBC = EgtGP( AuxId, GDB_RT.GLOB)
-- verifico che la mortasa non sia orientata verso il basso (-5 deg) o che ci sia una testa da sotto
local bFaceDown = ( vtExtr:getZ() < - 0.1)
if bFaceDown then
local sErr = 'Machining from bottom impossible : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
-- determino l'altezza della mortasa (0=faccia di fondo)
local rfDtMrt = Frame3d( ptBC, vtExtr)
local b3DtMrt = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, rfDtMrt)
local dAltMort = b3DtMrt:getDimZ()
-- verifico se di tipo pocket
local bPocket = ( EgtGetInfo( Proc.Id, 'P05', 'i') == 1)
if bPocket then bMakeAntiSplitPath = false end
-- recupero il raggio minimo della mortasa
local dMinRad = 1000
local nSt, nEnd = EgtCurveDomain( AuxId)
for i = nSt, nEnd - 1 do
local dRad = EgtCurveCompoRadius( AuxId, i)
if dRad > 0 and dRad < dMinRad then
dMinRad = dRad
end
end
-- recupero la lavorazione
local sMillType = 'DtMortise'
-- recupero la lavorazione : prima ricerca per sola tipologia
local sMilling = WM.FindMilling( sMillType)
if not sMilling then
local sErr = 'Milling not found in library : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione : seconda ricerca con tipologia e diametro massimo
sMilling = WM.FindMilling( sMillType, nil, nil, nil, 2 * dMinRad)
if not sMilling then
local sErr = 'Radius too small : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
-- recupero il diametro dell'utensile e l'angolo di spoglia
local dToolDiam = 100
local dMaxMat = 30
local dSideAng = 0
local bCW = true
if EgtMdbSetCurrMachining( sMilling) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dToolDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dToolDiam
dToolDiam = max( dToolDiam, 10)
dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT) or dMaxMat
dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG) or dSideAng
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
bCW = ( dSpeed >= 0)
end
end
-- verifico che la profondità non superi il massimo materiale dell'utensile
if dAltMort > dMaxMat + 10 * GEO.EPS_SMALL then
local sErr = 'Error : DtMortise Depth bigger than Tool Cutting edge'
EgtOutLog( sErr)
return false, sErr
end
-- se con tasca, la lavoro
if bPocket then
-- recupero il contorno della tasca (seconda curva ausiliaria)
local sVal = EgtGetInfo( Proc.Id, 'AUXID')
local vsAuxId = EgtSplitString( sVal)
local Aux2Id
if vsAuxId and #vsAuxId >=2 then
Aux2Id = tonumber( vsAuxId[2])
end
if Aux2Id then Aux2Id = Aux2Id + Proc.Id end
if not Aux2Id or ( EgtGetType( Aux2Id) & GDB_FY.GEO_CURVE) == 0 then
local sErr = 'Missing pocket geometry : Error on DtMortise ' .. tostring( Proc.Id)
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione
local sPocketing
if Proc.Prc ~= 53 then
sPocketing = WM.FindPocketing( 'Mortise', dToolDiam)
end
if not sPocketing then
sPocketing = WM.FindPocketing( 'Pocket', dToolDiam)
end
if not sPocketing then
local sErr = 'Error : Mortise or Pocket not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione di svuotatura
local sName = 'DtMtPck_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Aux2Id, -1}})
-- dichiaro non si generano sfridi per VMill
local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
-- verifico se necessarie più passate (distanza all'imbocco ortogonale all'asse)
local vtDiff = EgtEP( AuxId, GDB_RT.GLOB) - EgtSP( AuxId, GDB_RT.GLOB)
local vtAx = EgtEV( AuxId, GDB_RT.GLOB) - EgtSV( AuxId, GDB_RT.GLOB)
vtAx:normalize()
local vtOrtDiff = vtDiff - vtDiff * vtAx * vtAx
local dDist = vtOrtDiff:len()
-- calcolo le passate
local nPass = ceil( dDist / ( 1.9 * dToolDiam))
local dStep = ( dDist - 0.95 * dToolDiam) / ( 2 * nPass)
for i = nPass, 1, -1 do
-- inserisco la lavorazione di contornatura
local sNameF = 'DtMt_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id)) .. '_' .. tostring( nPass)
local nMchFId = EgtAddMachining( sNameF, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sNameF .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- imposto offset
local dOffs = ( i - 1) * dStep
EgtSetMachiningParam( MCH_MP.OFFSR, dOffs)
-- sistemo il lato e la direzione di lavoro
EgtSetMachiningParam( MCH_MP.WORKSIDE, EgtIf( bCW, MCH_MILL_WS.LEFT, MCH_MILL_WS.RIGHT))
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, false, true))
-- dichiaro non si generano sfridi per VMill
local sUserNotes = 'MaxElev='.. EgtNumToString( dMaxMat - 0.1, 1) .. '; VMRS=0;'
EgtSetMachiningParam( MCH_MP.USERNOTES, sUserNotes)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
end
return true
end
---------------------------------------------------------------------
return WPDM
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,152 @@
-- WProcessMark.lua by Egaltech s.r.l. 2021/04/20
-- Gestione calcolo marcatura per Pareti
-- Tabella per definizione modulo
local WPMK = {}
-- Include
require( 'EgtBase')
EgtOutLog( ' WProcessMark started', 1)
-- Dati
local WD = require( 'WallData')
local WM = require( 'WMachiningLib')
---------------------------------------------------------------------
-- Riconoscimento della feature
function WPMK.Identify( Proc)
return (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 60)
end
---------------------------------------------------------------------
-- Classificazione della feature
function WPMK.Classify( Proc, b3Raw)
-- recupero il versore estrusione o normale se testo
local vtN
if EgtGetType( Proc.Id) ~= GDB_TY.EXT_TEXT then
vtN = EgtCurveExtrusion( Proc.Id, GDB_ID.ROOT)
else
vtN = EgtTextNormVersor( Proc.Id, GDB_ID.ROOT)
end
-- verifico sia una curva/testo
if not vtN then
return false
end
-- verifico se la marcatura è lavorabile (solo da sopra)
return ( vtN:getZ() > WD.NZ_MINA)
end
----------------------------------------------------------------------
-- Classificazione del flip della feature per nesting
-- return nFlip0, nFlip1
function WPMK.FlipClassify( Proc)
local nFlip0, nFlip1
local vtN
if EgtGetType( Proc.Id) ~= GDB_TY.EXT_TEXT then
vtN = EgtCurveExtrusion( Proc.Id, GDB_ID.ROOT)
else
vtN = EgtTextNormVersor( Proc.Id, GDB_ID.ROOT)
end
-- verifico sia una curva/testo
if not vtN then
return false
end
-- verifico se la marcatura è lavorabile (solo da sopra)
nFlip0 = EgtIf( vtN:getZ() > WD.NZ_MINA, 100, 0)
nFlip1 = EgtIf( - vtN:getZ() > WD.NZ_MINA, 100, 0)
return nFlip0, nFlip1
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function WPMK.Make( Proc, nRawId, b3Raw)
-- recupero eventuale geometria ausiliaria
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + Proc.Id end
-- recupero i dati della marcatura
local vtExtr
if EgtGetType( Proc.Id) ~= GDB_TY.EXT_TEXT then
vtExtr = EgtCurveExtrusion( Proc.Id, GDB_RT.GLOB)
else
vtExtr = EgtTextNormVersor( Proc.Id, GDB_ID.ROOT)
end
-- verifico sia una curva/testo
if not vtExtr then
local sErr = 'Error : Mark with geometry type not accepted'
EgtOutLog( sErr)
return false, sErr
end
-- verifico che la marcatura non sia orientata verso il basso
if vtExtr:getZ() < WD.NZ_MINA then
local sErr = 'Error : Mark from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione
local sMilling = WM.FindMilling( 'Text')
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione di fresatura
local sName = 'Decor_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, -1}})
-- imposto posizione braccio porta testa
if vtExtr:getY() <= 0 then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
-- eventuale lavorazione su seconda geometria
if AuxId then
-- inserisco la lavorazione di fresatura
local sName2 = 'Decor2_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchF2Id = EgtAddMachining( sName, sMilling)
if not nMchF2Id then
local sErr = 'Error adding machining ' .. sName2 .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- imposto posizione braccio porta testa
if vtExtr:getY() <= 0 then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchF2Id, false)
return false, sErr
end
-- se geometria a X maggiore, la sposto prima
local ptS1 = EgtSP( Proc.Id, GDB_ID.ROOT)
local ptS2 = EgtSP( AuxId, GDB_ID.ROOT)
if ptS2:getX() > ptS1:getX() then
EgtRelocateGlob( nMchF2Id, nMchFId, GDB_IN.BEFORE)
end
end
return true
end
---------------------------------------------------------------------
return WPMK
@@ -0,0 +1,303 @@
-- WProcessMortise.lua by Egaltech s.r.l. 2021/07/30
-- Gestione calcolo mortase per Pareti
-- Tabella per definizione modulo
local WPM = {}
-- Include
require( 'EgtBase')
local WL = require( 'WallLib')
EgtOutLog( ' WProcessMortise started', 1)
-- Dati
local WD = require( 'WallData')
local WM = require( 'WMachiningLib')
---------------------------------------------------------------------
-- Riconoscimento della feature
function WPM.Identify( Proc)
return ( (( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 50) or
(( Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 53))
end
---------------------------------------------------------------------
-- Classificazione della feature: decide se la feature è in una posizione che per lavorala
-- deve essere ribaltata o no
function WPM.Classify( Proc, b3Raw)
-- recupero e verifico il percorso supplementare
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + Proc.Id end
-- recupero versore estrusione della curva supplementare e non più della superficie
-- perché quest'ultima potrebbe non avere il fondo e dare quindi un risultato non corretto
local vtExtr = EgtCurveExtrusion( AuxId or GDB_ID.NULL, GDB_ID.ROOT)
-- recupero i dati della faccia di fondo
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- verifico sia una superficie
if not vtExtr then
return false
end
if not vtN then
return false
end
-- Confronto le direzioni Z dei 2 versori : se diverse la faccia 0 non è il fondo => mortasa passante
if abs( vtExtr:getZ() - vtN:getZ()) > 10 * GEO.EPS_SMALL then
return true
-- altrimenti è chiusa
else
-- verifico se la mortasa è lavorabile da sopra
return ( vtN:getZ() > WD.NZ_MINA)
end
end
----------------------------------------------------------------------
-- Classificazione del flip della feature per nesting
-- return nFlip0, nFlip1
function WPM.FlipClassify( Proc)
-- recupero e verifico il percorso supplementare
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + Proc.Id end
-- recupero versore estrusione della curva supplementare e non più della superficie
-- perché quest'ultima potrebbe non avere il fondo e dare quindi un risultato non corretto
local vtExtr = EgtCurveExtrusion( AuxId or GDB_ID.NULL, GDB_ID.ROOT)
-- recupero i dati della faccia di fondo
local ptC, vtN = EgtSurfTmFacetCenter( Proc.Id, 0, GDB_ID.ROOT)
-- verifico sia una superficie
if not vtExtr then
return false
end
if not vtN then
return false
end
-- Confronto le direzioni Z dei 2 versori : se diverse la faccia 0 non è il fondo => mortasa passante
if abs( vtExtr:getZ() - vtN:getZ()) > 10 * GEO.EPS_SMALL then
return 100, 100
-- altrimenti è chiusa
else
-- verifico se la mortasa è lavorabile da sopra
nFlip0 = EgtIf( vtN:getZ() > WD.NZ_MINA, 100, 0)
nFlip1 = EgtIf( - vtN:getZ() > WD.NZ_MINA, 100, 0)
end
return nFlip0, nFlip1
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function WPM.Make( Proc, nRawId, b3Raw)
-- recupero e verifico l'entità curva
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then AuxId = AuxId + Proc.Id end
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
local sErr = 'Error : missing profile geometry'
EgtOutLog( sErr)
return false, sErr
end
-- recupero versore estrusione della curva supplementare
local vtExtr = EgtCurveExtrusion( AuxId, GDB_ID.ROOT)
-- recupero i dati della faccia di fondo
local frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( Proc.Id, 0, GDB_ID.ROOT)
local ptC = ORIG()
local vtN = V_NULL()
if frMor then
ptC = frMor:getOrigin()
vtN = frMor:getVersZ()
end
-- verifico se è presente il fondo (sempre faccia 0)
local bClosedBtm = AreSameVectorApprox( vtExtr, vtN)
-- Se curva di contorno aperta
local dLenOpenSide = 0
if not EgtCurveIsClosed( AuxId) then
-- se c'è il fondo
if bClosedBtm then
local NewId, nCount = EgtExtractSurfTmFacetLoops( Proc.Id, 0, EgtGetParent( Proc.Id))
if NewId then
-- elimino eventuali loop interni (non dovrebbero comunque esserci)
for i = 1, nCount - 1 do
EgtErase( NewId + i)
end
-- sostituisco il loop esterno alla curva originale
EgtModifyCurveExtrusion( NewId, vtExtr, GDB_ID.ROOT)
EgtRelocate( NewId, AuxId, GDB_IN.AFTER)
EgtErase( AuxId)
EgtChangeId( NewId, AuxId)
-- sistemo i lati aperti
local vFacAdj = EgtSurfTmFacetAdjacencies( Proc.Id, 0)[1]
if vFacAdj then
local sOpen = ''
for i = 1, #vFacAdj do
if vFacAdj[i] < 0 then
sOpen = sOpen .. EgtIf( #sOpen > 0, ',', '') .. tostring( i - 1)
local dLen = dist( EgtUP( AuxId, i-1), EgtUP( AuxId, i))
dLenOpenSide = max( dLen, dLenOpenSide)
end
end
if #sOpen > 0 then
EgtSetInfo( AuxId, 'OPEN', sOpen)
end
end
end
-- altrimenti aperta
else
dLenOpenSide = dist( EgtSP( AuxId), EgtEP( AuxId))
local _, nCrvCnt = EgtCurveDomain( AuxId)
EgtCloseCurveCompo( AuxId)
EgtSetInfo( AuxId, 'OPEN', nCrvCnt)
end
end
-- Se mortasa passante
if not bClosedBtm then
-- creo superficie chiusa
local nFlat = EgtSurfTmByFlatContour( EgtGetParent( AuxId), AuxId, 0.05)
if nFlat then
-- la superficie deve sempre essere rivolta verso l'alto
local vtNN = EgtSurfTmFacetNormVersor( nFlat, 0, GDB_ID.ROOT)
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
ptC = frMor:getOrigin()
vtN = frMor:getVersZ()
-- verifico se copiare la geometria lungo l'asse Z
local b3Aux = EgtGetBBoxRef( AuxId, GDB_BB.STANDARD, frMor)
local bxMax = b3Aux:getMax()
local b3Mor = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frMor)
local bxMin = b3Mor:getMin()
local dMove = bxMin:getZ() - bxMax:getZ()
if vtNN:getZ() < 0.1 then dMove = -dMove end
-- se il percorso ausiliario è esterno al grezzo, lo riavvicino
if abs( dMove) > GEO.EPS_SMALL then
AuxId = EgtCopyGlob( AuxId, WL.GetAddGroup( Proc.PartId))
EgtMove( AuxId, Vector3d( 0, 0, dMove), GDB_RT.GLOB)
EgtMove( nFlat, Vector3d( 0, 0, dMove), GDB_RT.GLOB)
frMor, dL, dW = EgtSurfTmFacetMinAreaRectangle( nFlat, 0, GDB_ID.ROOT)
ptC = frMor:getOrigin()
vtN = frMor:getVersZ()
end
-- cancello le prove del misfatto (superficie piana)
EgtErase( nFlat)
end
end
-- scrivo info nel log
EgtOutLog( 'ptC=' .. tostring( ptC) ..' vtN=' .. tostring( vtN), 3)
-- Se mortasa chiusa
local bForceOneSide
local bRevertSide
if bClosedBtm then
-- verifico che la mortasa non sia orientata verso il basso (limite -5 deg)
if vtN:getZ() < WD.NZ_MINA then
local sErr = 'Error : Mortise from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- altrimenti passante
else
-- determino se la mortasa da lavorare sul lato opposto sia di angolo inferiore a quello consentito
if abs( vtN:getZ()) > 0.1 then
bForceOneSide = true
end
-- determino se è meglio lavorare la mortasa nel lato opposto
if vtN:getZ() < -GEO.EPS_SMALL then
bRevertSide = true
end
end
-- determino altezza della mortasa
local b3Mor = EgtGetBBoxRef( Proc.Id, GDB_BB.STANDARD, frMor)
local dMorH = b3Mor:getDimZ()
-- elevazione del punto centro
local _, dCenElev = WL.GetPointDirDepth( Proc.PartId, ptC, vtN)
dMorH = max( dMorH, dCenElev or 0)
-- determino larghezza della mortasa
if dL < dW then dL, dW = dW, dL end
dW = max( dW, min( 2 * dW, dLenOpenSide))
-- recupero la lavorazione
local sPocketing
if Proc.Prc ~= 53 then
sPocketing = WM.FindPocketing( 'Mortise', dW)
end
if not sPocketing then
sPocketing = WM.FindPocketing( 'Pocket', dW)
end
if not sPocketing then
local sErr = 'Error : Mortise or Pocket not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- recupero i dati dell'utensile
local dMillDiam = 20
local dMaxDepth = 0
local bCW = true
if EgtMdbSetCurrMachining( sPocketing) then
local sTuuid = EgtMdbGetCurrMachiningParam( MCH_MP.TUUID)
if EgtTdbSetCurrTool( EgtTdbGetToolFromUUID( sTuuid) or '') then
dMillDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM) or dMillDiam
dMaxDepth = ( EgtTdbGetCurrToolMaxDepth() or dMaxDepth)
local dSpeed = EgtMdbGetCurrMachiningParam( MCH_MP.SPEED) or 0
bCW = ( dSpeed >= 0)
end
end
-- inserisco la lavorazione di svuotatura
local sName = 'Mort_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sPocketing)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sPocketing
EgtOutLog( sErr)
return false, sErr
end
-- verifico se invertire versore estrusione geometria
if bRevertSide then
EgtModifyCurveExtrusion( AuxId, -vtExtr, GDB_ID.ROOT)
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ AuxId, -1}})
-- sistemo la direzione di lavoro
EgtSetMachiningParam( MCH_MP.INVERT, EgtIf( bCW, true, false))
-- imposto posizione braccio porta testa
if vtN:getY() < GEO.EPS_SMALL then
if bRevertSide then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
end
else
if bRevertSide then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
end
local sWarn
local nDepthMin
-- se elevazione superiore a massimo affondamento della fresa, riduco opportunamente
if dMorH > dMaxDepth + 10 * GEO.EPS_SMALL then
sWarn = 'Warning in mortise : elevation (' .. EgtNumToString( dMorH,1) .. ') bigger than max tool depth (' .. EgtNumToString( dMaxDepth,1) .. ')'
-- se non ho invertito la direzione di estrusione
if not bRevertSide then
nDepthMin = dMaxDepth - EgtIf( not bClosedBtm and not bForceOneSide, dMorH * 2, dMorH)
else
nDepthMin = dMaxDepth
end
EgtSetMachiningParam( MCH_MP.DEPTH, nDepthMin)
dMorH = dMaxDepth
EgtOutLog( sWarn .. ' (process ' .. tostring( Proc.Id) .. ')')
else
if not bClosedBtm and not bForceOneSide then -- se mortasa passante setto metà profondità
nDepthMin = -dMorH
EgtSetMachiningParam( MCH_MP.DEPTH, nDepthMin)
elseif bRevertSide then
EgtSetMachiningParam( MCH_MP.DEPTH, dMorH)
end
end
-- imposto elevazione
EgtSetMachiningParam( MCH_MP.USERNOTES, 'MaxElev=' .. EgtNumToString( dMorH, 1) .. ';')
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
return true, sWarn
end
---------------------------------------------------------------------
return WPM
@@ -0,0 +1,58 @@
-- WProcessSawCut.lua by Egaltech s.r.l. 2021/04/28
-- Gestione calcolo taglio di lama per Pareti
-- Tabella per definizione modulo
local WPSC = {}
-- Include
require( 'EgtBase')
local WL = require( 'WallLib')
local Cut = require( 'WProcessCut')
EgtOutLog( ' WProcessSawCut started', 1)
-- Dati
local WD = require( 'WallData')
local WM = require( 'WMachiningLib')
---------------------------------------------------------------------
-- Riconoscimento della feature
function WPSC.Identify( Proc)
return ( ( Proc.Grp == 0 or Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 13)
end
---------------------------------------------------------------------
-- Classificazione della feature
function WPSC.Classify( Proc, b3Raw)
-- recupero i dati del versore direzione di accesso della lavorazione
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if not AuxId then return false end
AuxId = AuxId + Proc.Id
local vtDir = EgtSV( AuxId, GDB_ID.ROOT)
return ( vtDir:getZ() > 0.5)
end
----------------------------------------------------------------------
-- Classificazione del flip della feature per nesting
-- return nFlip0, nFlip1
function WPSC.FlipClassify( Proc)
-- recupero i dati del versore direzione di accesso della lavorazione
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if not AuxId then return false end
AuxId = AuxId + Proc.Id
local vtDir = EgtSV( AuxId, GDB_ID.ROOT)
local vtDirZ = vtDir:getZ()
nFlip0 = EgtIf( vtDirZ > 0.5, 100, 0)
nFlip1 = EgtIf( - vtDirZ > 0.5, 100, 0)
return nFlip0, nFlip1
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function WPSC.Make( Proc, nRawId, b3Raw)
return Cut.Make( Proc, nRawId, b3Raw)
end
---------------------------------------------------------------------
return WPSC
@@ -0,0 +1,104 @@
-- WProcessText.lua by Egaltech s.r.l. 2021/04/20
-- Gestione calcolo testi per Travi
-- Tabella per definizione modulo
local WPT = {}
-- Include
require( 'EgtBase')
EgtOutLog( ' WProcessText started', 1)
-- Dati
local WD = require( 'WallData')
local WM = require( 'WMachiningLib')
---------------------------------------------------------------------
-- Riconoscimento della feature
function WPT.Identify( Proc)
return ( Proc.Grp == 4 and Proc.Prc == 61)
end
---------------------------------------------------------------------
-- Classificazione della feature
function WPT.Classify( Proc, b3Raw)
-- recupero i dati del testo
local vtN = EgtTextNormVersor( Proc.Id, GDB_ID.ROOT)
-- verifico sia un testo
if not vtN then
return false
end
-- verifico se il testo è lavorabile (solo da sopra)
return ( vtN:getZ() > WD.NZ_MINA)
end
----------------------------------------------------------------------
-- Classificazione del flip della feature per nesting
-- return nFlip0, nFlip1
function WPT.FlipClassify( Proc)
local nFlip0, nFlip1
-- recupero i dati del testo
local vtN = EgtTextNormVersor( Proc.Id, GDB_ID.ROOT)
-- verifico sia un testo
if not vtN then
return false
end
-- verifico se il testo è lavorabile (solo da sopra)
nFlip0 = EgtIf( vtN:getZ() > WD.NZ_MINA, 100, 0)
nFlip1 = EgtIf( - vtN:getZ() > WD.NZ_MINA, 100, 0)
return nFlip0, nFlip1
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
function WPT.Make( Proc, nRawId, b3Raw)
-- recupero i dati del testo
local vtN = EgtTextNormVersor( Proc.Id, GDB_ID.ROOT)
-- verifico sia un testo
if not vtN then
local sErr = 'Error : Text with geometry type not accepted'
EgtOutLog( sErr)
return false, sErr
end
-- verifico che il testo non sia orientato verso il basso
if vtN:getZ() < WD.NZ_MINA then
local sErr = 'Error : Text from bottom impossible'
EgtOutLog( sErr)
return false, sErr
end
-- recupero la lavorazione
local sMilling = WM.FindMilling( 'Text')
if not sMilling then
local sErr = 'Error : milling not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione di fresatura
local sName = 'Text_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sMilling)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sMilling
EgtOutLog( sErr)
return false, sErr
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, -1}})
-- imposto posizione braccio porta testa
if vtN:getY() <= 0 then
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YM)
else
EgtSetMachiningParam( MCH_MP.SCC, MCH_SCC.ADIR_YP)
end
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
return true
end
---------------------------------------------------------------------
return WPT
@@ -0,0 +1,115 @@
-- WProcessVariant.lua by Egaltech s.r.l. 2021/08/27
-- Gestione calcolo Feature Custom (Variant) per Pareti
-- Tabella per definizione modulo
local WPV = {}
-- Include
require( 'EgtBase')
local WL = require( 'WallLib')
EgtOutLog( ' WProcessVariant started', 1)
-- Dati
local WD = require( 'WallData')
local WM = require( 'WMachiningLib')
---------------------------------------------------------------------
-- Riconoscimento della feature
function WPV.Identify( Proc)
return (( Proc.Grp == 0 or Proc.Grp == 1 or Proc.Grp == 2 or Proc.Grp == 3 or Proc.Grp == 4) and Proc.Prc == 900)
end
---------------------------------------------------------------------
-- Classificazione della feature: decide se la feature è in una posizione lavorabile
local function ClassifyCode_1( Proc, b3Raw)
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then
AuxId = AuxId + Proc.Id
end
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
local sErr = 'Error : missing containement geometry'
EgtOutLog( sErr)
return false
end
local vtExtr = EgtCurveExtrusion( AuxId or GDB_ID.NULL, GDB_ID.ROOT)
return ( vtExtr:getZ() > -0.01)
end
---------------------------------------------------------------------
function WPV.Classify( Proc, b3Raw)
-- recupero il codice identificativo
local sCode = EgtGetInfo( Proc.Id, 'DES')
-- gestione in base al codice
if sCode == '1' then
return ClassifyCode_1( Proc, b3Raw)
else
return false
end
end
---------------------------------------------------------------------
-- Applicazione della lavorazione
local function MakeCode_1( Proc, nRawId, b3Raw)
-- recupero e verifico l'entità curva associata
local AuxId = EgtGetInfo( Proc.Id, 'AUXID', 'i')
if AuxId then
AuxId = AuxId + Proc.Id
end
if not AuxId or ( EgtGetType( AuxId) & GDB_FY.GEO_CURVE) == 0 then
local sErr = 'Error : missing containement geometry'
EgtOutLog( sErr)
return false, sErr
end
local vtExtr = EgtCurveExtrusion( AuxId or GDB_ID.NULL, GDB_ID.ROOT)
-- recupero la lavorazione
local sSurfFin = WM.FindSurfacing( 'Finishing')
if not sSurfFin then
local sErr = 'Error : surface finishing not found in library'
EgtOutLog( sErr)
return false, sErr
end
-- inserisco la lavorazione di finitura superficie
local sName = 'SurfFin_' .. ( EgtGetName( Proc.Id) or tostring( Proc.Id))
local nMchFId = EgtAddMachining( sName, sSurfFin)
if not nMchFId then
local sErr = 'Error adding machining ' .. sName .. '-' .. sSurfFin
EgtOutLog( sErr)
return false, sErr
end
EgtSetInfo( nMchFId, 'Part', Proc.PartId)
-- se lavorazione di fianco setto la nota per spostarla dopo i tagli di lama
if vtExtr:getZ() < WD.NZ_MINA then
EgtSetInfo( nMchFId, 'MOVE_AFTER', 1)
end
-- aggiungo geometria
EgtSetMachiningGeometry( {{ Proc.Id, -1},{AuxId, -1}})
-- imposto posizione braccio porta testa
local nSCC = MCH_SCC.ADIR_ZP
if AreSameVectorApprox( vtExtr, Z_AX()) then
nSCC = EgtIf( Proc.Box:getDimX() >= Proc.Box:getDimY(), MCH_SCC.ADIR_YP, MCH_SCC.ADIR_XP)
end
EgtSetMachiningParam( MCH_MP.SCC, nSCC)
-- eseguo
if not EgtApplyMachining( true, false) then
local _, sErr = EgtGetLastMachMgrError()
EgtSetOperationMode( nMchFId, false)
return false, sErr
end
return true
end
---------------------------------------------------------------------
function WPV.Make( Proc, nRawId, b3Raw)
-- recupero il codice identificativo
local sCode = EgtGetInfo( Proc.Id, 'DES')
-- gestione in base al codice
if sCode == '1' then
return MakeCode_1( Proc, nRawId, b3Raw)
else
return false, 'Feature Id Code non recognized for machining'
end
end
---------------------------------------------------------------------
return WPV
@@ -0,0 +1,691 @@
-- WallExec.lua by Egaltech s.r.l. 2022/03/15
-- Libreria esecuzione lavorazioni per Pareti
-- Tabella per definizione modulo
local WallExec = {}
-- Include
require( 'EgtBase')
-- Carico i dati globali e libero tutti gli altri
_G.package.loaded.WallData = nil
_G.package.loaded.CutData = nil
_G.package.loaded.MillingData = nil
_G.package.loaded.PocketingData = nil
_G.package.loaded.DrillData = nil
_G.package.loaded.SawingData = nil
local WD = require( 'WallData')
if WALL and WALL.NESTINGCORNERBL then WD.NESTING_CORNER = 'BL' end
-- Carico le librerie
_G.package.loaded.WMachiningLib = nil
_G.package.loaded.WallLib = nil
_G.package.loaded.WProcessCut = nil
_G.package.loaded.WProcessDoubleCut = nil
_G.package.loaded.WProcessSawCut = nil
_G.package.loaded.WProcessLapJoint = nil
_G.package.loaded.WProcessDrill = nil
_G.package.loaded.WProcessMortise = nil
_G.package.loaded.WProcessDtMortise = nil
_G.package.loaded.WProcessMark = nil
_G.package.loaded.WProcessText = nil
_G.package.loaded.WProcessFreeContour = nil
_G.package.loaded.WProcessVariant = nil
local WM = require( 'WMachiningLib')
local WL = require( 'WallLib')
local Cut = require( 'WProcessCut')
local DoubleCut = require( 'WProcessDoubleCut')
local SawCut = require( 'WProcessSawCut')
local LapJoint = require( 'WProcessLapJoint')
local Drill = require( 'WProcessDrill')
local Mortise = require( 'WProcessMortise')
local DtMortise = require( 'WProcessDtMortise')
local Mark = require( 'WProcessMark')
local Text = require( 'WProcessText')
local FreeContour = require( 'WProcessFreeContour')
local Variant = require( 'WProcessVariant')
-------------------------------------------------------------------------------------------------------------
-- *** Inserimento delle pareti nel pannello ***
-------------------------------------------------------------------------------------------------------------
function WallExec.ProcessWalls( dRawL, dRawW, dRawH, vWall, bMachGroupOk, bNewProcess, nRawOutlineId)
-- Creazione nuovo gruppo di lavoro
if not bMachGroupOk then
local sMgName = EgtGetMachGroupNewName( 'Mach')
local NewMgId = EgtAddMachGroup( sMgName)
if not NewMgId then
local sOut = 'Errore nella creazione del gruppo di lavoro ' .. sMgName
return false, sOut
end
end
-- Impostazione della tavola
EgtSetTable( 'Tab')
-- Area tavola
local b3Tab = EgtGetTableArea()
-- Calcolo posizione estremo di riferimento della tavola rispetto a sua origine in BL
local OrigOnTab
local nCorner
local sOrigCorner = WD.ORIG_CORNER or 'BR'
if WD.GetOrigCorner then
sOrigCorner = WD.GetOrigCorner( EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'REFPOS', 'i') or 1)
end
if sOrigCorner == 'TL' then
nCorner = MCH_CR.TL
OrigOnTab = Point3d( 0, b3Tab:getDimY(), 0)
elseif sOrigCorner == 'BL' then
nCorner = MCH_CR.BL
OrigOnTab = Point3d( 0, 0, 0)
elseif sOrigCorner == 'TR' then
nCorner = MCH_CR.TR
OrigOnTab = Point3d( b3Tab:getDimX(), b3Tab:getDimY(), 0)
elseif sOrigCorner == 'BR' then
nCorner = MCH_CR.BR
OrigOnTab = Point3d( b3Tab:getDimX(), 0, 0)
elseif sOrigCorner == 'TM' then
nCorner = MCH_CR.TR
OrigOnTab = Point3d( WD.MID_REF, b3Tab:getDimY(), 0)
elseif sOrigCorner == 'BM' then
nCorner = MCH_CR.BR
OrigOnTab = Point3d( WD.MID_REF, 0, 0)
end
-- Impostazione dell'attrezzaggio di default
EgtImportSetup()
-- Creazione del grezzo e suo posizionamento in macchina
local nRaw = GDB_ID.NULL
if nRawOutlineId and nRawOutlineId ~= GDB_ID.NULL then
nRaw = EgtAddRawPartWithPart( 0, nRawOutlineId, 0, WD.RAWCOL)
else
nRaw = EgtAddRawPart( Point3d(0,0,0), dRawL, dRawW, dRawH, WD.RAWCOL)
end
EgtMoveToCornerRawPart( nRaw, OrigOnTab, nCorner)
EgtSetInfo( nRaw, 'ORD', 1)
-- Inserimento dei pezzi nel grezzo
for i = 1, #vWall do
-- assegno identificativo pezzo
local Pz = vWall[i].Id
-- dati del pezzo
local b3Part = EgtGetBBoxGlob( Pz or GDB_ID.NULL, GDB_BB.EXACT)
local b3Solid = vWall[i].Box
if b3Part:isEmpty() or b3Solid:isEmpty() then break end
local PartLen = b3Solid:getDimX()
local PartWidth = b3Solid:getDimY()
local PartHeight = b3Solid:getDimZ()
local vtOffs = b3Part:getMin() - b3Solid:getMin()
-- creo o pulisco gruppo geometrie aggiuntive
if not WL.CreateOrEmptyAddGroup( Pz) then
local sOut = 'Error creating Additional Group in Part ' .. tostring( Pz)
return false, sOut
end
-- inserisco il pezzo nel grezzo
EgtDeselectPartObjs( Pz)
local ptPos
if bNewProcess then
local sNestingRef = ( WALL.NESTING_REF or WD.NESTING_CORNER)
if sNestingRef == 'TL' then
ptPos = Point3d( vWall[i].PosX, dRawW - PartWidth - vWall[i].PosZ, ( dRawH - PartHeight) / 2) + vtOffs
elseif sNestingRef == 'TR' then
ptPos = Point3d( dRawL - PartLen - vWall[i].PosX, dRawW - PartWidth - vWall[i].PosZ, ( dRawH - PartHeight) / 2) + vtOffs
elseif sNestingRef == 'BR' then
ptPos = Point3d( dRawL - PartLen - vWall[i].PosX, vWall[i].PosZ, ( dRawH - PartHeight) / 2) + vtOffs
else -- 'BL'
ptPos = Point3d( vWall[i].PosX, vWall[i].PosZ, ( dRawH - PartHeight) / 2) + vtOffs
end
else
local dPosH = EgtIf( vWall[i].PosY < 0.1, ( dRawH - PartHeight) / 2, vWall[i].PosY)
ptPos = Point3d( dRawL - vWall[i].PosX - PartLen, vWall[i].PosZ, dPosH) + vtOffs
end
EgtAddPartToRawPart( Pz, ptPos, nRaw)
end
return true
end
-------------------------------------------------------------------------------------------------------------
-- *** Inserimento delle lavorazioni nelle pareti ***
-------------------------------------------------------------------------------------------------------------
function WallExec.CollectFeatures( PartId, b3Raw)
-- recupero le feature
local vProc = {}
local LayerId = {}
LayerId[1] = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, 'Outline')
LayerId[2] = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, 'Processings')
for nInd = 1, #LayerId do
local ProcId = EgtGetFirstInGroup( LayerId[nInd] or GDB_ID.NULL)
while ProcId do
local nEntType = EgtGetType( ProcId)
if nEntType == GDB_TY.SRF_MESH or nEntType == GDB_TY.EXT_TEXT or
nEntType == GDB_TY.CRV_LINE or nEntType == GDB_TY.CRV_ARC or nEntType == GDB_TY.CRV_BEZ or nEntType == GDB_TY.CRV_COMPO then
local nGrp = EgtGetInfo( ProcId, 'GRP', 'i')
local nPrc = EgtGetInfo( ProcId, 'PRC', 'i')
local nDo = EgtGetInfo( ProcId, 'DO', 'i') or 1
local nCutId = EgtGetInfo( EgtGetParent( EgtGetParent( ProcId)), 'CUTID', 'i') or 0
local nTaskId = EgtGetInfo( ProcId, 'TASKID', 'i') or 0
if nGrp and nPrc and nDo == 1 then
local Proc = {}
Proc.PartId = PartId
Proc.Id = ProcId
Proc.Grp = nGrp
Proc.Prc = nPrc
Proc.Flg = 1
Proc.Fct = EgtSurfTmFacetCount( ProcId) or 0
Proc.Diam = 0
Proc.Fcs = 0
Proc.Fce = 0
Proc.CutId = nCutId
Proc.TaskId = nTaskId
Proc.Box = EgtGetBBoxGlob( ProcId, GDB_BB.STANDARD)
if Proc.Box and not Proc.Box:isEmpty() then
table.insert( vProc, Proc)
-- se foro
if Drill.Identify( Proc) then
-- assegno diametro e facce di ingresso e uscita (dati tabelle sempre per riferimento)
Proc.Diam, Proc.Fcs, Proc.Fce = Drill.GetData( Proc, b3Raw)
-- verifico se necessaria seconda lavorazione da parte opposta per foro più lungo della punta
if Drill.Split( Proc, b3Raw) then
-- aggiorno flags prima parte foro (dati tabelle sempre per riferimento)
Proc.Flg = 2
-- definisco dati seconda parte
local Proc2 = {}
Proc2.PartId = PartId
Proc2.Id = ProcId
Proc2.Grp = nGrp
Proc2.Prc = nPrc
Proc2.Flg = -2
Proc2.Box = BBox3d( Proc.Box)
Proc2.Fct = Proc.Fct
Proc2.Diam = Proc.Diam
Proc2.Fcs = Proc.Fce
Proc2.Fce = Proc.Fcs
Proc2.CutId = Proc.CutId
Proc2.TaskId = Proc.TaskId
table.insert( vProc, Proc2)
end
end
else
EgtOutLog( ' Feature ' .. tostring( Proc.Id) .. ' is empty (no geometry)')
end
end
end
ProcId = EgtGetNext( ProcId)
end
end
return vProc
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 taglio doppio
elseif DoubleCut.Identify( Proc) then
local bOk = DoubleCut.Classify( Proc, b3Raw)
if not bOk then Proc.Flg = 0 end
-- se taglio con lama
elseif SawCut.Identify( Proc) then
local bOk = SawCut.Classify( Proc, b3Raw)
if not bOk then Proc.Flg = 0 end
-- se tasca
elseif LapJoint.Identify( Proc) then
local bOk = LapJoint.Classify( Proc, b3Raw)
if not bOk then Proc.Flg = 0 end
-- se foratura
elseif Drill.Identify( Proc) then
local bOk = Drill.Classify( Proc, b3Raw)
if not bOk then Proc.Flg = 0 end
-- se mortasatura
elseif Mortise.Identify( Proc) then
local bOk = Mortise.Classify( Proc, b3Raw)
if not bOk then Proc.Flg = 0 end
-- se mortasatura a coda di rondine
elseif DtMortise.Identify( Proc) then
local bOk = DtMortise.Classify( Proc, b3Raw)
if not bOk then Proc.Flg = 0 end
-- se marcatura
elseif Mark.Identify( Proc) then
local bOk = Mark.Classify( Proc, b3Raw)
if not bOk then Proc.Flg = 0 end
-- se testo
elseif Text.Identify( Proc) then
local bOk = Text.Classify( Proc, b3Raw)
if not bOk then Proc.Flg = 0 end
-- se contorno libero, outile o aperture
elseif FreeContour.Identify( Proc) then
local bOk = FreeContour.Classify( Proc, b3Raw)
if not bOk then Proc.Flg = 0 end
-- se feature custom (Variant)
elseif Variant.Identify( Proc) then
local bOk = Variant.Classify( Proc, b3Raw)
if not bOk then Proc.Flg = 0 end
end
end
end
-------------------------------------------------------------------------------------------------------------
local function PrintFeatures( vProc)
EgtOutLog( ' *** Feature List ***')
for i = 1, #vProc do
local Proc = vProc[i]
local sOut = string.format( 'Part=%3d Proc=%3d Grp=%1d Prc=%3d TC=%2d/%d Flg=%2d Fcse=%1d,%1d Diam=%.2f Fct=%2d Dbl=%2d Dlt=%.1f Box=%s',
Proc.PartId, Proc.Id, Proc.Grp, Proc.Prc, Proc.TaskId, Proc.CutId,
Proc.Flg, Proc.Fcs, Proc.Fce, Proc.Diam, Proc.Fct, Proc.Double or 0, Proc.Delta or 0, tostring( Proc.Box))
EgtOutLog( sOut)
end
end
-------------------------------------------------------------------------------------------------------------
local function AddFeatureMachining( Proc, nRawId, b3Raw)
local bOk = true
local sErr = ''
EgtOutLog( ' * Process ' .. tostring( Proc.Id) .. ' *', 1)
-- 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 taglio doppio (1/2-011-X) o taglio doppio longitudinale (0-012-X)
elseif DoubleCut.Identify( Proc) then
-- esecuzione taglio
bOk, sErr = DoubleCut.Make( Proc, nRawId, b3Raw)
-- se taglio con lama (0/3/4-013-X)
elseif SawCut.Identify( Proc) then
-- esecuzione taglio
bOk, sErr = SawCut.Make( Proc, nRawId, b3Raw)
-- se tasca (3/4-030-X) o similari
elseif LapJoint.Identify( Proc) then
-- esecuzione tasca
bOk, sErr = LapJoint.Make( Proc, nRawId, b3Raw)
-- se foratura ( 3/4-040-X)
elseif Drill.Identify( Proc) then
-- esecuzione foratura
bOk, sErr = Drill.Make( Proc, nRawId, b3Raw)
-- se mortasatura (3/4-050-X) o similari
elseif Mortise.Identify( Proc) then
-- esecuzione mortasatura
bOk, sErr = Mortise.Make( Proc, nRawId, b3Raw)
-- se mortasatura a coda di rondine (3/4-055-X)
elseif DtMortise.Identify( Proc) then
-- esecuzione mortasatura a coda di rondine
bOk, sErr = DtMortise.Make( Proc, nRawId, b3Raw)
-- se marcatura (3/4-060-X)
elseif Mark.Identify( Proc) then
-- esecuzione marcatura
bOk, sErr = Mark.Make( Proc, nRawId, b3Raw)
-- se testo (4-061-X)
elseif Text.Identify( Proc) then
-- esecuzione incisione testo
bOk, sErr = Text.Make( Proc, nRawId, b3Raw)
-- se contorno libero, outline o apertura ( 0/3/4-250/251/252-X)
elseif FreeContour.Identify( Proc) then
-- esecuzione contorno
bOk, sErr = FreeContour.Make( Proc, nRawId, b3Raw)
-- se feature custom (Variant)
elseif Variant.Identify( Proc) then
-- esecuzione
bOk, sErr = Variant.Make( Proc, nRawId, b3Raw)
-- altrimenti feature non riconosciuta
else
bOk = false
sErr = 'Feature type non recognized for machining'
end
return bOk, sErr
end
-------------------------------------------------------------------------------------------------------------
local function MoveMachiningsAtEnd( nPhase, nType, sStartName, sProperty)
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
( ( EgtGetInfo( nOperId, 'MOVE_AFTER', 'i') == 1 ) or
( 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
------ Ordinamento dei tagli, delle fresature e delle forature -------
local function SpSorting( TabCut, PrevMch, nType, bOneWay)
-- ordino le lavorazioni (in gruppi di max 1000 entità se 32bit 10000 se 64bit)
--EgtOutLog('Dati per ShortestPath :')
local SP_MAX_ENT = EgtIf( EgtIs64bit(), 10000, 1000)
local nBase = 0
while nBase < #TabCut do
-- calcolo ordinamento
EgtSpInit()
for i = 1, min( #TabCut - nBase, SP_MAX_ENT) do
local ptS = TabCut[nBase+i].Start
local ptE = TabCut[nBase+i].End
EgtSpAddPoint( ptS:getX(), ptS:getY(), ptS:getZ(), 0, 0,
ptE:getX(), ptE:getY(), ptE:getZ(), 0, 0)
end
EgtSpSetAngularParams( 1000, 40, 2000, 60)
EgtSpSetOpenBound( true, SHP_OB.NEAR_PNT, 50000, 0, 0, 0, 0)
if WD.BEAM_MACHINE and (nType & MCH_OY.SAWING) == MCH_OY.SAWING then
EgtSpSetOpenBound( false, SHP_OB.NEAR_PNT, -50000, 0, 0, 0, 0)
end
EgtSpSetZzOwStep( 10)
local nType = EgtIf( bOneWay, SHP_TY.ONEWAY_YM, SHP_TY.OPEN)
local vOrd = EgtSpCalculate( nType)
EgtSpTerminate()
-- applico ordinamento calcolato
if vOrd then
for i = 1, #vOrd do
EgtRelocateGlob( TabCut[nBase+vOrd[i]].Mch, PrevMch, GDB_IN.AFTER)
PrevMch = TabCut[nBase+vOrd[i]].Mch
end
end
-- incremento la base
nBase = nBase + SP_MAX_ENT
end
return PrevMch
end
local function ContainsStartName( nOperId, StartNames)
local bFound = false
for i = 1, #StartNames do
local sStartName = StartNames[i]
if string.sub( EgtGetName( nOperId), 1, #sStartName) == sStartName then
bFound = true
end
end
return bFound
end
------ Ordinamento dei tagli, delle fresature e delle forature -------
local function SortMach( nPhase, PrevMch, nPartId, nType, StartNames, bExistName, sInfo, bExistInfo, bOneWay, bByTool, bByToolAngle)
-- dichiarazione tabella
local TabCut = {}
-- Recupero gli identificativi delle lavorazioni e annullo eventuali allungamenti e Id di altre lavorazioni rappresentate
local nOperId = EgtGetNextOperation( PrevMch)
while nOperId do
local nOperType = EgtGetOperationType( nOperId)
-- Se appartiene alla fase corrente e taglio con lama non da sopra (sempre su 1 sola entità)
if EgtGetOperationPhase( nOperId) == nPhase and ( nType & nOperType) == nOperType and
( not nPartId or EgtGetInfo( nOperId, 'Part', 'i') == nPartId) and
( not StartNames or ( bExistName and ContainsStartName( nOperId, StartNames)) or
( not bExistName and not ContainsStartName( nOperId, StartNames))) and
( not sInfo or ( bExistInfo and EgtGetInfo( nOperId, sInfo, 'i') == 1) or
( not bExistInfo and EgtGetInfo( nOperId, sInfo, 'i') ~= 1)) then
-- non si deve cambiare lo stato di attivazione della lavorazione (se disabilitata errata)
EgtSetCurrMachining( nOperId)
if not EgtIsMachiningEmpty() then
-- punto iniziale e finale e direzione della lavorazione
local ptStart = EgtGetMachiningStartPoint()
local ptEnd = EgtGetMachiningEndPoint()
local sTUUID = ''
local nToolType = 0
local nToolDiam = 0
local nToolDir = 0
if bByTool then
sTUUID = EgtGetMachiningParam( MCH_MP.TUUID)
local sToolName = EgtTdbGetToolFromUUID( sTUUID)
if EgtTdbSetCurrTool( sToolName) then
nToolType = EgtTdbGetCurrToolParam( MCH_TP.TYPE)
nToolDiam = EgtTdbGetCurrToolParam( MCH_TP.TOTDIAM)
else
sTUUID = ''
end
end
if bByToolAngle then
local nClId = EgtGetFirstNameInGroup( nOperId, 'CL')
local nPathId = EgtGetFirstInGroup( nClId or GDB_ID.NULL)
local vtTool = EgtGetInfo( nPathId, 'EXTR', 'v')
nToolDir = EgtIf( vtTool:getZ() > 0.999999, 1, 0)
end
table.insert( TabCut, {Mch=nOperId, Ent=nEntId, Start=ptStart, End=ptEnd, Tool=sTUUID, ToolType=nToolType, ToolDiam=nToolDiam, ToolDir=nToolDir})
end
end
-- Passo alla operazione successiva
nOperId = EgtGetNextOperation( nOperId)
end
if bByTool then
function ToolCompare(a,b)
if a.ToolType < b.ToolType then
return true
elseif a.ToolType == b.ToolType then
if a.ToolDiam > b.ToolDiam then
return true
elseif a.ToolDiam == b.ToolDiam then
if a.Tool < b.Tool then
return true
elseif a.Tool == b.Tool then
if bByToolAngle then
if a.ToolDir > b.ToolDir then
return true
elseif a.ToolDir == b.ToolDir then
return a.Mch < b.Mch
end
else
return a.Mch < b.Mch
end
end
end
end
return false
end
-- test della funzione di ordinamento
if EgtGetDebugLevel() >= 3 then
EgtOutLog( ' CompareFeatures Test ')
local bCompTest = true
for i = 1, #TabCut do
for j = i + 1, #TabCut do
local bComp1 = ToolCompare( TabCut[i], TabCut[j])
local bComp2 = ToolCompare( TabCut[j], TabCut[i])
if bComp1 == bComp2 then
bCompTest = false
EgtOutLog( string.format( ' ProcId : %d vs %d --> ERROR', TabCut[i].Mch, TabCut[j].Mch))
end
end
end
if bCompTest then
EgtOutLog( ' ALL OK')
end
end
table.sort(TabCut, ToolCompare)
-- table.sort(TabCut, function(a,b) return a.ToolType < b.ToolType and a.ToolDiam > b.ToolDiam and a.Tool < b.Tool end)
local SupportTabCut = {}
local nPrevTUUID = 0
local nPrevTDirZ = 1
for i = 1, #TabCut do
-- se tuuid uguale al precedente, lo aggiungo alla lista
if nPrevTUUID == TabCut[i].Tool and ( not bByToolAngle or nPrevTDirZ == TabCut[i].ToolDir) then
table.insert( SupportTabCut, TabCut[i])
-- se tuuid diverso,
else
-- faccio calcolare la lista
PrevMch = SpSorting( SupportTabCut, PrevMch, nType, bOneWay)
-- cancello la lista e aggiorno tuuid corrente
SupportTabCut = {}
nPrevTUUID = TabCut[i].Tool
if bByToolAngle then
nPrevTDirZ = TabCut[i].ToolDir
end
table.insert( SupportTabCut, TabCut[i])
end
end
-- calcolo ultima lista
if #SupportTabCut > 0 then
PrevMch = SpSorting( SupportTabCut, PrevMch, nType, bOneWay)
end
else
PrevMch = SpSorting( TabCut, PrevMch, nType, bOneWay)
end
return PrevMch
end
-------------------------------------------------------------------------------------------------------------
local function SortMachinings( nPhase, PrevMch, nPartId)
-- Chiodature
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'Nail_'}, true)
-- Tagli con sega a catena che sono rifiniture di spigoli
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MORTISING, { 'Csaw_'}, false)
-- Forature orizzontali con punte lunghe
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.DRILLING, { 'LhDrill_'}, true, 'MOVE_AFTER', false, true)
-- Preforature per fori inclinati
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.POCKETING, { 'PreDrill_'}, true)
-- Forature e Svuotature
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.DRILLING + MCH_OY.POCKETING + MCH_OY.MILLING, { 'SideMill_', 'Clean_'}, false, 'MOVE_AFTER', false, false, true)
-- -- Forature ***
-- PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.DRILLING, nil, nil, 'MOVE_AFTER', false)
-- -- Svuotature ***
-- PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.POCKETING, nil, nil, 'MOVE_AFTER', false)
-- -- Fresature che sono rifiniture di spigoli
-- PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'Clean_'}, false, 'MOVE_AFTER', false, false, true)
-- Lavorazioni di superficie
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_MY.SURFFINISHING, nil, nil, 'MOVE_AFTER', false)
-- Fresature per gole
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'Gorge_'}, true, 'MOVE_AFTER', false)
-- Fresature che sono rifiniture di spigoli
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'SideMill_'}, true, 'MOVE_AFTER', false, false, true, true)
-- Fresature che sono puliture di spigoli
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'Clean_'}, true, 'MOVE_AFTER', false)
-- Tagli per gole
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.SAWING, { 'GorgeCut_'}, true)
-- Tagli con lama
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.SAWING)
-- Qui rimozione sfridi (se ci sono lavorazioni successive)
-- Fresature dei lapjoint che necessitano di gorge
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, { 'SideMill_'}, true, 'MOVE_AFTER', true, false, true, true)
-- Tagli con sega a catena che vanno fatti dopo i tagli con lama
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MORTISING, { 'Csaw_'}, true)
-- Fresature (puliture di spigoli) che vanno fatte dopo i tagli con lama
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.MILLING, nil, nil, 'MOVE_AFTER', true)
-- Forature che vanno fatte dopo i tagli con lama
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.DRILLING, nil, nil, 'MOVE_AFTER', true)
-- Svuotature che vanno fatte dopo i tagli con lama
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_OY.POCKETING, nil, nil, 'MOVE_AFTER', true)
-- Lavorazioni di superficie che vanno fatte dopo i tagli con lama
PrevMch = SortMach( nPhase, PrevMch, nPartId, MCH_MY.SURFFINISHING, nil, nil, 'MOVE_AFTER', true)
return PrevMch
end
-------------------------------------------------------------------------------------------------------------
function WallExec.ProcessFeatures()
-- errori e stato
local nTotErr = 0
local Stats = {}
-- recupero il grezzo e il suo box
local nRawId = EgtGetFirstRawPart()
local b3Raw = EgtGetRawPartBBox( nRawId)
-- raccolgo l'elenco dei pezzi
local vPart = {}
local nPartId = EgtGetFirstPartInRawPart( nRawId)
while nPartId do
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
table.insert( vPart, {Id=nPartId, Box=b3Solid})
nPartId = EgtGetNextPartInRawPart( nPartId)
end
-- raccolgo l'elenco delle feature da lavorare, ciclando sui pezzi
local vProc = {}
for i = 1, #vPart do
-- recupero le feature di lavorazione della parete
local vPartProc = WallExec.CollectFeatures( vPart[i].Id, b3Raw)
vProc = EgtJoinTables( vProc, vPartProc)
end
-- classifico le feature
ClassifyFeatures( vProc, b3Raw)
-- Eventuale determinazione delle feature lavorabili in parallelo (implementata nella configurazione macchina)
-- si impostano i flag Double (nil/0=no, 1=su X, 2=su Y) e Delta (offset tra T14 e T12 positivo o negativo)
if WD.FindFeaturesInDouble then
WD.FindFeaturesInDouble( vProc, b3Raw)
end
-- debug
if EgtGetDebugLevel() >= 1 then
PrintFeatures( vProc)
end
EgtOutLog( ' *** AddMachinings ***', 1)
-- inserisco le lavorazioni
for i = 1, #vProc do
-- creo la lavorazione
local Proc = vProc[i]
if Proc.Flg ~= 0 then
local bOk, sMsg = AddFeatureMachining( Proc, nRawId, b3Raw)
if not bOk then
nTotErr = nTotErr + 1
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
elseif sMsg and #sMsg > 0 then
table.insert( Stats, {Err=-1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
else
table.insert( Stats, {Err=0, Msg='', Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
end
elseif not Proc.Double then
local sMsg = 'Feature not machinable by orientation'
table.insert( Stats, {Err=1, Msg=sMsg, Rot=0, CutId=Proc.CutId, TaskId=Proc.TaskId})
end
end
EgtOutLog( ' *** End AddMachinings ***', 1)
-- se macchina pareti
if not WD.BEAM_MACHINE then
-- riordino le lavorazioni tra tutti i pezzi
local nPhase = 1
local PrevMch = EgtGetPhaseDisposition( nPhase)
SortMachinings( nPhase, PrevMch)
-- Aggiornamento finale di tutto
EgtSetCurrPhase( 1)
EgtApplyAllMachinings()
-- altrimenti macchina travi
else
-- dichiaro lavorazione pareti
EgtSetInfo( EgtGetCurrMachGroup() or GDB_ID.NULL, 'Wall', '1')
-- ordino i pezzi secondo le X decrescenti
local function CompareParts( P1, P2)
return P1.Box:getCenter():getX() > P2.Box:getCenter():getX()
end
table.sort( vPart, CompareParts)
-- riordino le lavorazioni sui singoli pezzi
local nPhase = 1
local PrevMch = EgtGetPhaseDisposition( nPhase)
for i = 1, #vPart do
PrevMch = SortMachinings( nPhase, PrevMch, vPart[i].Id)
end
-- aggiungo dati su prima disposizione
local nDispId = EgtGetPhaseDisposition( 1)
EgtSetInfo( nDispId, 'TYPE', 'START')
EgtSetInfo( nDispId, 'ORD', 1)
-- aggiungo flag su ultima lavorazione
local nLastMchId = EgtGetLastActiveOperation()
EgtSetCurrMachining( nLastMchId)
EgtSetMachiningParam( MCH_MP.USERNOTES, 'Cut;')
-- aggiungo disposizione per lo scarico
EgtAddPhase()
local nRawId = EgtGetFirstRawPart()
EgtKeepRawPart( nRawId, 1)
local nDisp2Id = EgtGetPhaseDisposition( 2)
EgtSetInfo( nDisp2Id, 'TYPE', 'END')
EgtSetInfo( nDisp2Id, 'ORD', 1)
-- Aggiornamento finale di tutto
EgtSetCurrPhase( 1)
local bApplOk, sApplErrors, sApplWarns = EgtApplyAllMachinings()
if not bApplOk then
nTotErr = nTotErr + 1
table.insert( Stats, {Err = 1, Msg=sApplErrors, Rot=0, CutId=0, TaskId=0})
elseif sApplWarns and #sApplWarns > 0 then
-- non interessano perchè riguardano lo scarico delle travi
end
end
-- restituzione risultati
return ( nTotErr == 0), Stats
end
-------------------------------------------------------------------------------------------------------------
return WallExec
@@ -0,0 +1,317 @@
-- WallLib.lua by Egaltech s.r.l. 2020/11/18
-- Libreria globale per Pareti
-- Tabella per definizione modulo
local WallLib = {}
-- Include
require( 'EgtBase')
EgtOutLog( ' WallLib started', 1)
-------------------------------------------------------------------------------------------------------------
function WallLib.GetAddGroup( PartId)
-- recupero il nome del gruppo di lavoro corrente
local sMchGrp = EgtGetMachGroupName( EgtGetCurrMachGroup() or GDB_ID.NULL)
if not sMchGrp then return nil, nil end
-- cerco il gruppo aggiuntivo omonimo nel pezzo e se esiste lo restituisco
local AddGrpId = EgtGetFirstNameInGroup( PartId or GDB_ID.NULL, sMchGrp)
-- restituisco Id e Nome
return AddGrpId, sMchGrp
end
-------------------------------------------------------------------------------------------------------------
function WallLib.CreateOrEmptyAddGroup( PartId)
-- recupero i dati del gruppo aggiuntivo
local AddGrpId, sMchGrp = WallLib.GetAddGroup( PartId)
if not sMchGrp then return false end
-- se esiste lo svuoto
if AddGrpId then
return EgtEmptyGroup( AddGrpId)
end
-- altrimenti lo creo
AddGrpId = EgtGroup( PartId or GDB_ID.NULL)
if not AddGrpId then return false end
-- assegno nome, flag di layer per gruppo di lavoro e colore
EgtSetName( AddGrpId, sMchGrp)
EgtSetInfo( AddGrpId, GDB_SI.MGRPONLY, EgtGetCurrMachGroup())
EgtSetColor( AddGrpId, Color3d( 80, 160, 160, 50))
return true
end
-------------------------------------------------------------------------------------------------------------
function WallLib.GetPointDirDepth( nRawId, ptP, vtDir)
-- recupero il solido del grezzo
local nSolId = EgtGetFirstNameInGroup( nRawId, 'RawSolid')
if not nSolId then return end
-- interseco con la retta
local bOk, vType, vPar = EgtLineSurfTmInters( ptP, vtDir, nSolId, GDB_RT.GLOB)
if not bOk then return end
if not vPar or #vPar == 0 then return -2 end
local dLenIn, dLenOut
for i = 1, #vPar do
if vPar[i] < 0 then
if vType[i] == GDB_SLT.IN or vType[i] == GDB_SLT.TG_INI then
dLenIn = -1
end
if vType[i] == GDB_SLT.OUT or vType[i] == GDB_SLT.TG_FIN then
dLenIn = -2
end
else
if vType[i] == GDB_SLT.IN or vType[i] == GDB_SLT.TG_INI then
dLenIn = vPar[i]
end
if vType[i] == GDB_SLT.OUT or vType[i] == GDB_SLT.TG_FIN or vType[i] == GDB_SLT.TOUCH then
dLenOut = vPar[i]
end
end
end
return dLenIn, dLenOut
end
---------------------------------------------------------------------
function WallLib.GetFaceElevation( nSurfId, nFac, nRawId)
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFac, GDB_ID.ROOT)
if not ptC or not vtN then return 0 end
local frOCS = Frame3d( ptC, vtN) ;
local b3Box = EgtGetBBoxRef( nSurfId, GDB_BB.STANDARD, frOCS)
local dElev = b3Box:getMax():getZ()
if nRawId then
local _, dCenElev = WallLib.GetPointDirDepth( nRawId, ptC, vtN)
if dCenElev and dCenElev > dElev then dElev = dCenElev end
local dOffsX = min( 20, b3Box:getDimX() / 4)
local _, dP1Elev = WallLib.GetPointDirDepth( nRawId, ptC + dOffsX * frOCS:getVersX(), vtN)
if dP1Elev and dP1Elev > dElev then dElev = dP1Elev end
local _, dP2Elev = WallLib.GetPointDirDepth( nRawId, ptC - dOffsX * frOCS:getVersX(), vtN)
if dP2Elev and dP2Elev > dElev then dElev = dP2Elev end
local dOffsY = min( 20, b3Box:getDimY() / 4)
local _, dP3Elev = WallLib.GetPointDirDepth( nRawId, ptC + dOffsY * frOCS:getVersY(), vtN)
if dP3Elev and dP3Elev > dElev then dElev = dP3Elev end
local _, dP4Elev = WallLib.GetPointDirDepth( nRawId, ptC - dOffsY * frOCS:getVersY(), vtN)
if dP4Elev and dP4Elev > dElev then dElev = dP4Elev end
end
return dElev
end
---------------------------------------------------------------------
function WallLib.GetFaceWithMostAdj( nSurfId, nPartId, bCompare3Fc, dCosSideAng)
-- recupero il numero di facce
local nFacCnt = EgtSurfTmFacetCount( nSurfId)
if not dCosSideAng then
dCosSideAng = -0.09
end
-- recupero le normali delle facce
local vvtN = {}
for i = 1, nFacCnt do
local _, vtN = EgtSurfTmFacetCenter( nSurfId, i - 1, GDB_ID.ROOT)
vvtN[i] = vtN ;
end
-- adiacenze e sottosquadra delle facce
local vAdj = {}
local vUcut = {}
local vOrtho = {}
local vBlind = {}
for i = 1, nFacCnt do
-- recupero le adiacenze del loop esterno
local vFacAdj = EgtSurfTmFacetAdjacencies( nSurfId, i - 1)[1]
-- le conto
local nCount = 0
for j = 1, #vFacAdj do
if vFacAdj[j] >= 0 then
nCount = nCount + 1
end
end
vAdj[i] = nCount
-- ne determino eventuale sottosquadra ( dal valore passato o - 3deg) e ortogonalità
local bUcut = false
local bOrtho = true
for j = 1, #vFacAdj do
if vFacAdj[j] >= 0 then
local vtN = vvtN[i]
local vtN2 = vvtN[vFacAdj[j]+1]
local dResV = vtN * vtN2
if dResV < dCosSideAng - GEO.EPS_SMALL then
bUcut = true
end
if abs( dResV) > 2 * GEO.EPS_SMALL then
bOrtho = false
end
end
end
-- verifico se schermata da altra faccia
local bBlind = false
for j = 1, nFacCnt do
if i ~= j then
if vvtN[i] * vvtN[j] < -0.5 then
bBlind = true
end
end
end
-- assegno i risultati
vUcut[i] = bUcut
vOrtho[i] = bOrtho
vBlind[i] = bBlind
end
-- se 4 facce tutte con adiacenza 2, allora è un tunnel
if nFacCnt == 4 then
if vAdj[1] == 2 and vAdj[2] == 2 and vAdj[3] == 2 and vAdj[4] == 2 then
-- se tutte le facce sono ortogonali tra loro esco con un flag che ne indica questa propietà
if vOrtho[1] == true and vOrtho[2] == true and vOrtho[3] == true and vOrtho[4] == true then
return -1, GEO.INFINITO, true
else
return -1, GEO.INFINITO
end
end
end
-- se 3 facce con una che ha 2 adiacenze e le altre hanno 1 adiacenza, allora è una semi-fessura
if bCompare3Fc and nFacCnt == 3 then
local nCount2Adc = 0
local nCount1Adc = 0
-- ottengo il numero di facce con due adiacenze e il numero di facce con una adiacenza
for i = 1, #vAdj do
if vAdj[i] == 2 then
nCount2Adc = nCount2Adc + 1
elseif vAdj[i] == 1 then
nCount1Adc = nCount1Adc + 1
end
end
-- se il numero di adiacenze corrisponde
if nCount2Adc == 1 and nCount1Adc == 2 then
if vOrtho[1] == true and vOrtho[2] == true and vOrtho[3] == true then
return -1, GEO.INFINITO, true
else
return -1, GEO.INFINITO
end
end
end
-- recupero le facce non in sottosquadra e con il maggior numero di adiacenze
local nFacInd = {}
local nMaxAdj = -1
local nSupAdj = -1
for i = 1, nFacCnt do
if not vUcut[i] and not vBlind[i] then
if vAdj[i] >= nMaxAdj and vAdj[i] > 0 then
table.insert( nFacInd, i - 1)
nMaxAdj = vAdj[i]
elseif vAdj[i] > 0 then
table.insert( nFacInd, i - 1)
end
end
if vAdj[i] > nSupAdj then
nSupAdj = vAdj[i]
end
end
-- verifico non ci sia una faccia in sottosquadra con adiacenza superiore
if nSupAdj > nMaxAdj then
return -2, GEO.INFINITO
end
-- premio la faccia con minore elevazione
local nFacOpt, nFacOpt2
local nOptAdj, nOptAdj2
local dMinElev, dMinElev2 = GEO.INFINITO, GEO.INFINITO
for i = 1, #nFacInd do
local dElev = WallLib.GetFaceElevation( nSurfId, nFacInd[i], nPartId)
if dElev < dMinElev and ( not nOptAdj or vAdj[nFacInd[i]+1] >= nOptAdj) then
if dMinElev < dMinElev2 then
nFacOpt2 = nFacOpt
nOptAdj2 = nOptAdj
dMinElev2 = dMinElev
end
nFacOpt = nFacInd[i]
nOptAdj = vAdj[nFacInd[i]+1]
dMinElev = dElev
elseif dElev < dMinElev2 and ( not nOptAdj2 or vAdj[nFacInd[i]+1] >= nOptAdj2) then
nFacOpt2 = nFacInd[i]
nOptAdj2 = vAdj[nFacInd[i]+1]
dMinElev2 = dElev
end
end
return nFacOpt, dMinElev, nFacOpt2, dMinElev2
end
---------------------------------------------------------------------
function WallLib.GetFaceHvRefDim( nSurfId, nFacet)
-- recupero centro e normale della faccia
local ptC, vtN = EgtSurfTmFacetCenter( nSurfId, nFacet, GDB_ID.ROOT)
if not ptC or not vtN then return end
-- riferimento tipo OCS della faccia (X orizz, Y max pendenza, Z normale)
local frHV = Frame3d( ptC, vtN)
if frHV:getVersY():getZ() < 0 then
frHV:rotate( ptC, vtN, 180)
end
-- determino l'ingombro in questo riferimento
local b3HV = EgtSurfTmGetFacetBBoxRef( nSurfId, nFacet, GDB_BB.STANDARD, frHV)
-- restituisco i valori calcolati
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
---------------------------------------------------------------------
function WallLib.GetNearestOrthoOpposite( vtRef, vtNorm)
-- se definita anche la normale alla faccia, elimino la parte di vtRef parallela a questa
local vtMyRef = Vector3d( vtRef)
if vtNorm then
vtMyRef = vtMyRef - ( vtMyRef * vtNorm) * vtNorm
vtMyRef:normalize()
end
-- devo confrontare la componente orizzontale con quella verticale
local dHorSq = vtMyRef:getX() * vtMyRef:getX() + vtMyRef:getY() * vtMyRef:getY()
local dVertSq = vtMyRef:getZ() * vtMyRef:getZ()
-- se prevalente la componente orizzontale
if dHorSq >= dVertSq then
if abs( vtMyRef:getX()) >= abs( vtMyRef:getY()) then
if vtMyRef:getX() > 0 then
return MCH_MILL_FU.ORTHO_LEFT
else
return MCH_MILL_FU.ORTHO_RIGHT
end
else
if vtMyRef:getY() > 0 then
return MCH_MILL_FU.ORTHO_FRONT
else
return MCH_MILL_FU.ORTHO_BACK
end
end
-- altrimenti prevale la verticale
else
if vtMyRef:getZ() > 0 then
return MCH_MILL_FU.ORTHO_DOWN
else
return MCH_MILL_FU.ORTHO_TOP
end
end
return nil
end
-------------------------------------------------------------------------------------------------------------
return WallLib
@@ -0,0 +1,454 @@
-- NestFlipAndRotate.lua by Egaltech s.r.l. 2021/11/25
-- Flip e rotazione ottimali per il nesting in base all'analisi delle features
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- NFAR.PARTID =
NFAR.RAW_GRAIN_DIR_X = true
local sLog = 'Flip And Rotate Part ' .. tostring( NFAR.PARTID)
EgtOutLog( sLog)
-- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Pareti
local sMachDir = EgtGetCurrMachineDir()
if not EgtExistsFile( sMachDir .. '\\Wall\\WallData.lua') then
NFAR.ERR = 12
NFAR.MSG = 'Error not configured for walls machine : ' .. sMachine
WriteErrToLogFile( NFAR.ERR, NFAR.MSG)
PostErrView( NFAR.ERR, NFAR.MSG)
return
end
-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie
EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Wall\\?.lua')
-- Carico le librerie
_G.package.loaded.WallExec = nil
local WE = require( 'WallExec')
_G.package.loaded.WProcessLapJoint = nil
local LapJoint = require( 'WProcessLapJoint')
_G.package.loaded.WProcessDrill = nil
local Drill = require( 'WProcessDrill')
_G.package.loaded.WProcessCut = nil
local Cut = require( 'WProcessCut')
_G.package.loaded.WProcessDoubleCut = nil
local DoubleCut = require( 'WProcessDoubleCut')
_G.package.loaded.WProcessSawCut = nil
local SawCut = require( 'WProcessSawCut')
_G.package.loaded.WProcessFreeContour = nil
local FreeContour = require( 'WProcessFreeContour')
_G.package.loaded.WProcessMortise = nil
local Mortise = require( 'WProcessMortise')
_G.package.loaded.WProcessDtMortise = nil
local DtMortise = require( 'WProcessDtMortise')
_G.package.loaded.WProcessMark = nil
local Mark = require( 'WProcessMark')
_G.package.loaded.WProcessText = nil
local Text = require( 'WProcessText')
-- Carico i dati globali
local WD = require( 'WallData')
local function ClassifyFlip( vPartProc, b3Part)
local FlipFeatureStates = {}
local bLapJoints = false
for nInd = 1, #vPartProc do
if LapJoint.Identify( vPartProc[nInd]) then
-- setto parametro Q
if vPartProc[nInd].Prc == 30 then
EgtSetInfo( vPartProc[nInd].Id, "Q08", 1)
EgtSetInfo( vPartProc[nInd].Id, "Q08A", 1)
else
EgtSetInfo( vPartProc[nInd].Id, "Q03", 1)
EgtSetInfo( vPartProc[nInd].Id, "Q03A", 1)
end
bLapJoints = true
local nFlip0, nFlip1 = LapJoint.FlipClassify(vPartProc[nInd])
if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then
table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1})
end
elseif Drill.Identify( vPartProc[nInd]) then
local nFlip0, nFlip1 = Drill.FlipClassify(vPartProc[nInd], b3Part)
if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then
table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1})
end
elseif Cut.Identify( vPartProc[nInd]) then
local nFlip0, nFlip1 = Cut.FlipClassify(vPartProc[nInd], b3Part)
if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then
table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1})
end
elseif DoubleCut.Identify( vPartProc[nInd]) then
-- setto parametro Q
if vPartProc[nInd].Prc == 12 then
EgtSetInfo( vPartProc[nInd].Id, "Q02", 1)
EgtSetInfo( vPartProc[nInd].Id, "Q02A", 1)
end
local nFlip0, nFlip1 = DoubleCut.FlipClassify(vPartProc[nInd], b3Part)
if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then
table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1})
end
elseif SawCut.Identify( vPartProc[nInd]) then
local nFlip0, nFlip1 = SawCut.FlipClassify(vPartProc[nInd], b3Part)
if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then
table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1})
end
elseif FreeContour.Identify( vPartProc[nInd]) then
local nFlip0, nFlip1 = FreeContour.FlipClassify(vPartProc[nInd], b3Part)
if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then
table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1})
end
elseif Mortise.Identify( vPartProc[nInd]) then
local nFlip0, nFlip1 = Mortise.FlipClassify(vPartProc[nInd], b3Part)
if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then
table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1})
end
elseif DtMortise.Identify( vPartProc[nInd]) then
local nFlip0, nFlip1 = DtMortise.FlipClassify(vPartProc[nInd], b3Part)
if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then
table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1})
end
elseif Mark.Identify( vPartProc[nInd]) then
local nFlip0, nFlip1 = Mark.FlipClassify(vPartProc[nInd], b3Part)
if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then
table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1})
end
elseif Text.Identify( vPartProc[nInd]) then
local nFlip0, nFlip1 = Text.FlipClassify(vPartProc[nInd], b3Part)
if nFlip0 and nFlip1 and nFlip0 ~= nFlip1 then
table.insert( FlipFeatureStates, { Flip0 = nFlip0, Flip1 = nFlip1})
end
end
end
return FlipFeatureStates, bLapJoints
end
local function ClassifyRotation( vPartProc)
local RotateFeatureStates = {}
for nInd = 1, #vPartProc do
if Drill.Identify( vPartProc[nInd]) then
local nRot0, nRot90, nRot180, nRot270 = Drill.RotateClassify(vPartProc[nInd], ValidRotations)
if nRot0 and nRot0 >= 0 then
table.insert( RotateFeatureStates, { Rot0 = nRot0, Rot90 = nRot90, Rot180 = nRot180, Rot270 = nRot270})
end
end
end
return RotateFeatureStates
end
---
local vPartProc = WE.CollectFeatures( NFAR.PARTID)
local b3Part = EgtGetBBoxGlob( NFAR.PARTID, GDB_BB.STANDARD)
local bManualFlip = EgtGetInfo( NFAR.PARTID, "MANUALFLIP", 'b')
local bManualRot = EgtGetInfo( NFAR.PARTID, "MANUALROT", 'b')
-- FLIP
local FlipFeatureStates, bLapJoints = ClassifyFlip( vPartProc, b3Part)
if not bManualFlip then
local bFlip
-- analizzo stati flip delle feature
local nFlip0Min = 100
local nFlip0Cnt = 0
local nFlip1Min = 100
local nFlip1Cnt = 0
-- calcolo punteggio minimo e sua molteplicita' per entrambi i lati
for nInd = 1, #FlipFeatureStates do
if FlipFeatureStates[nInd].Flip0 < nFlip0Min then
nFlip0Min = FlipFeatureStates[nInd].Flip0
nFlip0Cnt = 1
elseif FlipFeatureStates[nInd].Flip0 == nFlip0Min then
nFlip0Cnt = nFlip0Cnt + 1
end
if FlipFeatureStates[nInd].Flip1 < nFlip1Min then
nFlip1Min = FlipFeatureStates[nInd].Flip1
nFlip1Cnt = 1
elseif FlipFeatureStates[nInd].Flip1 == nFlip1Min then
nFlip1Cnt = nFlip1Cnt + 1
end
end
-- calcolo lato con punteggio minore o molteplicita' piu' alta
if nFlip0Min == nFlip1Min then
if nFlip0Cnt > nFlip1Cnt then
bFlip = true
elseif nFlip0Cnt < nFlip1Cnt then
bFlip = false
elseif bLapJoints then
-- se equivalenti ma ci sono lap joints, fisso il flip per non avere problemi con le aree di lavorazione nel nesting
bFlip = false
end
elseif nFlip0Min < nFlip1Min then
bFlip = true
else
bFlip = false
end
if bFlip ~= nil then
-- se una posizione è più conveniente dell'altra setto info nel pezzo
EgtSetInfo( NFAR.PARTID, "NestAllowFlip", false)
EgtSetInfo( NFAR.PARTID, "NestFlip", bFlip)
else
EgtSetInfo( NFAR.PARTID, "NestAllowFlip", true)
end
if bFlip then
-- flip pezzo
EgtRotate( NFAR.PARTID, b3Part:getCenter(), X_AX(), 180, GDB_RT.GLOB)
-- modifico le info del pezzo
local nPartFlip = EgtGetInfo( NFAR.PARTID, "INVERTED", 'i') or 0
local nTotFlip = EgtIf( nPartFlip == 180, 0, 180)
EgtSetInfo( NFAR.PARTID, "INVERTED", nTotFlip)
EgtSetInfo( NFAR.PARTID, "FLIPROTMODIFIED", 1)
end
end
-- rimuovo parametri Q
local b3PartInside = BBox3d( b3Part)
b3PartInside:expand( - WD.INSIDE_RAW_TOL)
for nInd = 1, #vPartProc do
local Proc = vPartProc[nInd]
if LapJoint.Identify( Proc) then
-- cerco la faccia rivolta verso l'alto e la faccia rivolta verso il basso
local nFaceInd = -1
local nFaceDownInd = -1
for nIdx = 0, Proc.Fct - 1 do
local vtN = EgtSurfTmFacetNormVersor( Proc.Id, nIdx, GDB_ID.ROOT)
if vtN:getZ() > 0.95 then
nFaceInd = nIdx
elseif vtN:getZ() < - 0.95 then
nFaceDownInd = nIdx
end
end
-- se è lap joint dall'alto
if nFaceInd ~= -1 and nFaceDownInd == -1 then
local ptCen = EgtSurfTmFacetCenter( Proc.Id, nFaceInd, GDB_ID.ROOT)
-- se all'interno rimuovo info Q
if EnclosesPointXY( b3PartInside, ptCen) then
-- resetto parametro Q
if Proc.Prc == 30 then
EgtRemoveInfo( Proc.Id, "Q08")
EgtRemoveInfo( Proc.Id, "Q08A")
else
EgtRemoveInfo( Proc.Id, "Q03")
EgtRemoveInfo( Proc.Id, "Q03A")
end
end
end
elseif DoubleCut.Identify( Proc) then
-- verifico se due facce e rivolto verso l'alto
if Proc.Fct == 2 then
local vtN = {}
vtN[1] = EgtSurfTmFacetNormVersor( Proc.Id, 0, GDB_ID.ROOT)
vtN[2] = EgtSurfTmFacetNormVersor( Proc.Id, 1, GDB_ID.ROOT)
if ( vtN[1]:getZ() >= 0.95 or vtN[2]:getZ() >= 0.95) then
local nFaceInd = EgtIf( vtN[1]:getZ() >= 0.95, 0, 1)
local ptCen = EgtSurfTmFacetCenter( Proc.Id, nFaceInd, GDB_ID.ROOT)
-- se all'interno rimuovo info Q
if EnclosesPointXY( b3PartInside, ptCen) then
-- resetto parametro Q
if Proc.Prc == 12 then
EgtRemoveInfo( Proc.Id, "Q02")
EgtRemoveInfo( Proc.Id, "Q02A")
end
end
end
end
end
end
-- ROTATION
nRotate = 0
-- venatura
EgtRemoveInfo( NFAR.PARTID, "HasGrainDirection")
local bGrain = false
local sGrainInfo = EgtGetInfo( NFAR.PARTID, "GRAINDIRECTION", 's')
if sGrainInfo then
local sGrainAlign = string.sub( sGrainInfo, 7)
local sGrainDir = string.sub( sGrainInfo, 1, 5)
if sGrainAlign == "1" and ( sGrainDir == "1,0,0" or sGrainDir == "0,1,0") then
EgtSetInfo( NFAR.PARTID, "HasGrainDirection", 1)
bGrain = true
-- trovo la rotazione ( a meno di 180°) che deve avere il pezzo per essere allineato con la venatura del grezzo
local nGrainRot = 0
if ( sGrainDir == "1,0,0" and not NFAR.RAW_GRAIN_DIR_X) or ( sGrainDir == "0,1,0" and NFAR.RAW_GRAIN_DIR_X) then
nGrainRot = 90
end
local nPartRot = EgtGetInfo( NFAR.PARTID, "ROTATED", 'i') or 0
if ( nGrainRot == 0 and ( nPartRot == 90 or nPartRot == 270)) or ( nGrainRot == 90 and ( nPartRot == 0 or nPartRot == 180)) then
local b3Part = EgtGetBBoxGlob( NFAR.PARTID, GDB_BB.STANDARD)
EgtRotate( NFAR.PARTID, b3Part:getCenter(), Z_AX(), 90, GDB_RT.GLOB)
nRotate = 90
end
end
end
if not bManualRot then
local RotateFeatureStates = ClassifyRotation( vPartProc)
-- analizzo stati rotazione delle feature
local nRot0Min = 100
local nRot0Cnt = 0
local nRot90Min = 100
local nRot90Cnt = 0
local nRot180Min = 100
local nRot180Cnt = 0
local nRot270Min = 100
local nRot270Cnt = 0
-- calcolo punteggio minimo e sua molteplicita' per tutte le rotazioni
for nInd = 1, #RotateFeatureStates do
if RotateFeatureStates[nInd].Rot0 < nRot0Min then
nRot0Min = RotateFeatureStates[nInd].Rot0
nRot0Cnt = 1
elseif RotateFeatureStates[nInd].Rot0 == nRot0Min then
nRot0Cnt = nRot0Cnt + 1
end
if RotateFeatureStates[nInd].Rot90 < nRot90Min then
nRot90Min = RotateFeatureStates[nInd].Rot90
nRot90Cnt = 1
elseif RotateFeatureStates[nInd].Rot90 == nRot90Min then
nRot90Cnt = nRot90Cnt + 1
end
if RotateFeatureStates[nInd].Rot180 < nRot180Min then
nRot180Min = RotateFeatureStates[nInd].Rot180
nRot180Cnt = 1
elseif RotateFeatureStates[nInd].Rot180 == nRot180Min then
nRot180Cnt = nRot180Cnt + 1
end
if RotateFeatureStates[nInd].Rot270 < nRot270Min then
nRot270Min = RotateFeatureStates[nInd].Rot270
nRot270Cnt = 1
elseif RotateFeatureStates[nInd].Rot270 == nRot270Min then
nRot270Cnt = nRot270Cnt + 1
end
end
-- se c'e' qualche stato di rotazione
local MinList = { { Rot = 0, Score = nRot0Min, ScoreCnt = nRot0Cnt},
{ Rot = 90, Score = nRot90Min, ScoreCnt = nRot90Cnt},
{ Rot = 180, Score = nRot180Min, ScoreCnt = nRot180Cnt},
{ Rot = 270, Score = nRot270Min, ScoreCnt = nRot270Cnt}}
local nRotateOpt = 0
if #RotateFeatureStates > 0 then
-- calcolo lato con punteggio minore o molteplicita' piu' alta
local nRotMax = 0
local nScoreMax = 0
local nScoreCnt = 0
for nInd = 1, #MinList do
if MinList[nInd].Score > nScoreMax then
nRotMax = MinList[nInd].Rot
nScoreMax = MinList[nInd].Score
nScoreCnt = MinList[nInd].ScoreCnt
elseif MinList[nInd].Score == nScoreMax then
if MinList[nInd].ScoreCnt > nScoreCnt then
nRotMax = MinList[nInd].Rot
nScoreMax = MinList[nInd].Score
nScoreCnt = MinList[nInd].ScoreCnt
end
end
end
nRotateOpt = nRotMax
else
nRotateOpt = 0
end
local bRotNest = false
local nStepRotNest = 0
-- se calcolate limitazioni su rotazioni
if MinList and #MinList > 0 then
-- verifico condizioni da permettere al nesting
if MinList[1].Score >= 50 and MinList[2].Score >= 50 and MinList[3].Score >= 50 and MinList[4].Score >= 50 then
bRotNest = true
nStepRotNest = 90
elseif (nRotateOpt == 0 and MinList[3].Score >= 50) or ( nRotateOpt == 90 and MinList[4].Score >= 50) then
bRotNest = true
nStepRotNest = 180
end
else
-- altrimenti permetto tutto
bRotNest = true
nStepRotNest = 90
end
-- verifico se ci sono fori lungo Y che bloccano la rotazione
local bDrillOnY = ( nStepRotNest == 180)
local b3Part = EgtGetBBoxGlob( NFAR.PARTID, GDB_BB.STANDARD)
if bGrain then
-- se venatura eseguo rotazione solo se è di 180°
if nRotateOpt == 180 then
EgtRotate( NFAR.PARTID, b3Part:getCenter(), Z_AX(), nRotateOpt, GDB_RT.GLOB)
nRotate = nRotate + nRotateOpt
end
nStepRotNest = 180
else
-- eseguo rotazione
EgtRotate( NFAR.PARTID, b3Part:getCenter(), Z_AX(), nRotateOpt, GDB_RT.GLOB)
nRotate = nRotate + nRotateOpt
end
-- verifico se rotazione è valida ( pezzo contenuto nel grezzo) solo se no venatura
if not bGrain then
b3Part = EgtGetBBoxGlob( NFAR.PARTID, GDB_BB.STANDARD)
local bValidRotationForRaw = b3Part:getDimX() < WD.MAX_LENGTH and b3Part:getDimY() < WD.MAX_WIDTH
local bRotatedIsValid = b3Part:getDimY() < WD.MAX_LENGTH and b3Part:getDimX() < WD.MAX_WIDTH
if not bValidRotationForRaw and bRotatedIsValid then
EgtRotate( NFAR.PARTID, b3Part:getCenter(), Z_AX(), 90, GDB_RT.GLOB)
nRotate = nRotate + 90
nStepRotNest = 180
end
end
-- se no venatura e non ci sono fori verifico se il pezzo cade
if not bGrain and not bDrillOnY then
b3Part = EgtGetBBoxGlob( NFAR.PARTID, GDB_BB.STANDARD)
local bValidRotation = b3Part:getDimX() > ( WD.INTRULLI or 1200)
-- verifico se ruotata resta valida
local bRotatedIsValid = b3Part:getDimY() > ( WD.INTRULLI or 1200)
-- se non è valida ma ruotato lo sarebbe, ruoto
if not bValidRotation and bRotatedIsValid and nStepRotNest ~= 180 then
EgtRotate( NFAR.PARTID, b3Part:getCenter(), Z_AX(), 90, GDB_RT.GLOB)
nRotate = nRotate + 90
nStepRotNest = 180
elseif bValidRotation and not bRotatedIsValid then
-- se fosse valida ma la sua ruotata no, allora blocco lo step nella rotazione del nesting
nStepRotNest = 180
end
end
-- setto info nel pezzo
if nRotate > 0 then
local nPartRot = EgtGetInfo( NFAR.PARTID, "ROTATED", 'i') or 0
local nTotRot = nPartRot + nRotate
nTotRot = EgtIf( nTotRot < 360, nTotRot, nTotRot - 360)
EgtSetInfo( NFAR.PARTID, "ROTATED", nTotRot)
EgtSetInfo( NFAR.PARTID, "FLIPROTMODIFIED", 1)
end
EgtSetInfo( NFAR.PARTID, "NestStepRot", nStepRotNest)
EgtSetInfo( NFAR.PARTID, "NestRot", nRotate)
EgtSetInfo( NFAR.PARTID, "NestAllowRot", bRotNest)
end
NFAR.ERR = 0
File diff suppressed because it is too large Load Diff
+32
View File
@@ -0,0 +1,32 @@
-- Rotate.lua by Egaltech s.r.l. 2020/04/06
-- Gestione ribaltamento di una Parete
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- recupero il pezzo del primo oggetto selezionato
local nId = EgtGetFirstSelectedObj()
local nPartId = EgtGetParent( EgtGetParent( nId or GDB_ID.NULL) or GDB_ID.NULL)
if not nPartId or not EgtIsPart( nPartId) then
EgtOutBox( 'Nessuna parete selezionata', 'Overturn Parete', 'ERROR')
return
end
-- recupero il box del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sName = EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId))
EgtOutBox( 'Box non definito per la parete ' .. sName, 'Overturn Parete', 'ERROR')
return
end
-- eseguo rotazione di 180 gradi attorno asse X
local ptRot = b3Solid:getMin() + Vector3d( 0, b3Solid:getDimY() / 2, b3Solid:getDimZ() / 2)
EgtRotate( nPartId, ptRot, X_AX(), 180, GDB_RT.GLOB)
EgtDraw()
-- end
+309
View File
@@ -0,0 +1,309 @@
-- Process.lua by Egaltech s.r.l. 2021/07/27
-- Gestione calcolo disposizione e lavorazioni per Pareti
-- Si opera sulla macchina corrente
-- 2020/12/09 Come per BatchProcess.lua si gestiscono anche rotazioni di inversione con valori negativi.
-- 2021/10/27 Come per BatchProcess.lua nel controllo spessore si deve considerare anche PosY.
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- Imposto direttorio libreria specializzata per Travi
local sBaseDir = EgtGetSourceDir()
EgtAddToPackagePath( sBaseDir .. 'LuaLibs\\?.lua')
-- Verifico che la macchina corrente sia abilitata per la lavorazione delle Pareti
local sMachDir = EgtGetCurrMachineDir()
if not sMachDir then
EgtOutBox( 'Errore nel caricamento della macchina corrente', 'Lavora Pareti', 'ERROR')
return
end
if not EgtExistsFile( sMachDir .. '\\Wall\\WallData.lua') then
EgtOutBox( 'La macchina corrente non è configurata per lavorare pareti', 'Lavora Pareti', 'ERROR')
return
end
-- Elimino direttori altre macchine e imposto direttorio macchina corrente per ricerca librerie
EgtRemoveBaseMachineDirFromPackagePath()
EgtAddToPackagePath( sMachDir .. '\\Wall\\?.lua')
-- Segnalazione avvio
EgtOutLog( '*** Wall Process Start ***', 1)
-- Carico le librerie
_G.package.loaded.WallExec = nil
local WE = require( 'WallExec')
local WL = require( 'WallLib')
-- Carico i dati globali
local WD = require( 'WallData')
-- Variabili di modulo
local vWall = {}
local dRawH
-------------------------------------------------------------------------------------------------------------
-- *** Recupero le pareti selezionate ***
-------------------------------------------------------------------------------------------------------------
local function MyProcessInputData()
-- Recupero le travi selezionate
local nId = EgtGetFirstSelectedObj()
while nId do
local nPartId = EgtGetParent( EgtGetParent( nId or GDB_ID.NULL) or GDB_ID.NULL)
if nPartId then
local bFound = false
for i = 1, #vWall do
if vWall[i].Id == nPartId then
bFound = true
break
end
end
if not bFound then
table.insert( vWall, { Id = nPartId, Name = ( EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId)))})
end
end
nId = EgtGetNextSelectedObj()
end
if #vWall == 0 then
EgtOutBox( 'Non sono state selezionate pareti', 'Lavora Pareti', 'ERROR')
return false
else
local sOut = ''
for i = 1, #vWall do
sOut = sOut .. vWall[i].Name .. ', '
end
sOut = sOut:sub( 1, -3)
EgtOutLog( 'Pareti selezionate : ' .. sOut, 1)
end
-- Ne recupero le dimensioni
for i = 1, #vWall do
local Ls = EgtGetFirstNameInGroup( vWall[i].Id, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
EgtOutBox( 'Box non definito per la parete ' .. vWall[i].Name, 'Lavora Pareti', 'ERROR')
return false
else
vWall[i].Box = b3Solid
end
end
-- Ne recupero la posizione
local CurrX = 50
for i = 1, #vWall do
local PosX = EgtGetInfo( vWall[i].Id, 'POSX', 'd') or CurrX
vWall[i].PosX = PosX
CurrX = CurrX + vWall[i].Box:getDimX() + 50
if WD.USE_POSY then
local PosY = EgtGetInfo( vWall[i].Id, 'POSY', 'd') or 0
vWall[i].PosY = max( PosY, 0)
else
vWall[i].PosY = 0
end
local PosZ = EgtGetInfo( vWall[i].Id, 'POSZ', 'd') or 50
vWall[i].PosZ = PosZ
end
-- Recupero informazione se progetto o produzione
local bProj = ( EgtGetInfo( EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL, 'PROJECT', 'i') == 1)
-- Eseguo eventuali rotazioni e inversioni testa-coda
for i = 1, #vWall do
local b3Solid = vWall[i].Box
-- rotazione
local dRotAng = EgtGetInfo( vWall[i].Id, 'ROTATED', 'd')
if dRotAng then
if abs( dRotAng) > GEO.EPS_ANG_SMALL and not EgtExistsInfo( vWall[i].Id, 'ROTATED_DONE') then
local ptRotCen = b3Solid:getCenter()
EgtRotate( vWall[i].Id, ptRotCen, X_AX(), dRotAng, GDB_RT.GLOB)
b3Solid:rotate( ptRotCen, X_AX(), dRotAng)
end
EgtSetInfo( vWall[i].Id, 'ROTATED_DONE', dRotAng)
end
-- inversione
local dInvAng = EgtGetInfo( vWall[i].Id, 'INVERTED', 'd')
if dInvAng then
if abs( dInvAng - 180) > GEO.EPS_ANG_SMALL and abs( dInvAng + 180) > GEO.EPS_ANG_SMALL and not EgtExistsInfo( vWall[i].Id, 'INVERTED_DONE') then
local ptInvCen = b3Solid:getCenter()
EgtRotate( vWall[i].Id, ptInvCen, Z_AX(), dInvAng - 180, GDB_RT.GLOB)
b3Solid:rotate( ptInvCen, Z_AX(), dInvAng - 180)
end
EgtSetInfo( vWall[i].Id, 'INVERTED_DONE', dInvAng)
end
-- correzioni per rotazioni non centrate di produzioni TS3 (quasi sempre multipli di 90 deg)
local sType = EgtGetInfo( vWall[i].Id, 'TYPE', 's')
if not bProj and dRotAng and dInvAng and sType ~= 'LAYER' then
if abs( dInvAng - 0) < GEO.EPS_ANG_SMALL then
if abs( dRotAng - 180) < GEO.EPS_ANG_SMALL then
vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY()
elseif abs( dRotAng - 270) < GEO.EPS_ANG_SMALL then
vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY()
end
elseif abs( dInvAng - 90) < GEO.EPS_ANG_SMALL or abs( dInvAng + 270) < GEO.EPS_ANG_SMALL then
vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY()
if abs( dRotAng - 180) < GEO.EPS_ANG_SMALL or abs( dRotAng + 180) < GEO.EPS_ANG_SMALL then
vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX()
elseif abs( dRotAng - 270) < GEO.EPS_ANG_SMALL or abs( dRotAng + 90) < GEO.EPS_ANG_SMALL then
vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX()
end
elseif abs( dInvAng - 180) < GEO.EPS_ANG_SMALL or abs( dInvAng + 180) < GEO.EPS_ANG_SMALL then
vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX()
if abs( dRotAng - 0) < GEO.EPS_ANG_SMALL then
vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY()
elseif abs( dRotAng - 270) < GEO.EPS_ANG_SMALL or abs( dRotAng + 90) < GEO.EPS_ANG_SMALL then
vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY()
elseif abs( dRotAng - 90) < GEO.EPS_ANG_SMALL or abs( dRotAng + 270) < GEO.EPS_ANG_SMALL then
vWall[i].PosZ = vWall[i].PosZ - vWall[i].Box:getDimY()
end
elseif abs( dInvAng - 270) < GEO.EPS_ANG_SMALL or abs( dInvAng + 90) < GEO.EPS_ANG_SMALL then
if abs( dRotAng - 0) < GEO.EPS_ANG_SMALL then
vWall[i].PosX = vWall[i].PosX - vWall[i].Box:getDimX()
end
end
end
end
-- Ne verifico le dimensioni
dRawH = vWall[1].Box:getDimZ() + vWall[1].PosY
local vWallErr = {}
for i = 2, #vWall do
local dDimH = vWall[i].Box:getDimZ() + vWall[i].PosY
if abs( dDimH - dRawH) > 10 * GEO.EPS_SMALL then
table.insert( vWallErr, i)
end
end
if #vWallErr > 0 then
local sOut = 'Rimosse pareti con spessore diverso dalla prima :\n'
for i = #vWallErr, 1, -1 do
sOut = sOut .. vWall[vWallErr[i]].Name .. '\n'
EgtDeselectPartObjs( vWall[vWallErr[i]].Id)
table.remove( vWall, vWallErr[i])
end
EgtOutLog( sOut, 1)
EgtOutBox( sOut, 'Lavora Pareti', 'INFO')
EgtDraw()
return false
end
EgtDeselectAll()
return true
end
-------------------------------------------------------------------------------------------------------------
-- *** Inserimento delle pareti nel grezzo ***
-------------------------------------------------------------------------------------------------------------
local function MyProcessWalls()
-- Ingombro totale delle pareti
local b3Tot = BBox3d( ORIG())
for i = 1, #vWall do
local ptMin = Point3d( - vWall[i].PosX - vWall[i].Box:getDimX(), vWall[i].PosZ, 0)
local ptMax = Point3d( - vWall[i].PosX, vWall[i].PosZ + vWall[i].Box:getDimY(), 0)
b3Tot:Add( ptMin)
b3Tot:Add( ptMax)
end
local dBoxL = b3Tot:getDimX()
local dBoxW = b3Tot:getDimY()
EgtOutLog( 'Ltot : ' .. EgtNumToString( dBoxL, 1) .. ' Wtot : '.. EgtNumToString( dBoxW, 1), 1)
-- Eventuali dimensioni predefinite del pannello
local BtlInfoId = EgtGetFirstNameInGroup( GDB_ID.ROOT, 'BtlInfo') or GDB_ID.NULL
local dPanelLen = EgtGetInfo( BtlInfoId, 'PANELLEN', 'd') or WD.STD_RAW_LENGTH
local dPanelWidth = EgtGetInfo( BtlInfoId, 'PANELWIDTH', 'd') or WD.STD_RAW_WIDTH
-- Richiedo lunghezza del grezzo e sovramateriale di testa
local vsVal = EgtDialogBox( 'Lavora Pareti' .. ' (Ltot='.. EgtNumToString( dBoxL + 0.05, 1) .. ', Wtot=' .. EgtNumToString( dBoxW + 0.05, 1) .. ')',
{'Lunghezza grezzo', EgtNumToString( dPanelLen, 1)},
{'Larghezza grezzo', EgtNumToString( dPanelWidth, 1)})
if not vsVal then
EgtDraw()
return
end
local dRawL = EgtEvalNumExpr( vsVal[1])
if not dRawL then
local sOut = 'Lunghezza grezzo errata : ' .. vsVal[1]
EgtOutLog( sOut)
EgtOutBox( sOut, 'Lavora Pareti', 'WARNING')
EgtDraw()
return false
end
dRawL = min( dRawL, WD.MAX_LENGTH)
local dRawW = EgtEvalNumExpr( vsVal[2])
if not dRawW then
local sOut = 'Larghezza grezzo errata : ' .. vsVal[2]
EgtOutLog( sOut)
EgtOutBox( sOut, 'Lavora Pareti', 'WARNING')
EgtDraw()
return false
end
dRawW = min( dRawW, WD.MAX_WIDTH )
-- Verifico dimensioni massime grezzo
if dRawL > WD.MAX_LENGTH + 10 * GEO.EPS_SMALL or dRawW > WD.MAX_WIDTH + 10 * GEO.EPS_SMALL or dRawH > WD.MAX_HEIGHT + 10 * GEO.EPS_SMALL then
local sOut = 'Grezzo (' .. EgtNumToString( dRawL, 2) .. ' x ' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' ..
'oltre il limite della macchina ('..EgtNumToString( WD.MAX_LENGTH, 2)..' x '..EgtNumToString( WD.MAX_WIDTH, 2)..' x '..EgtNumToString( WD.MAX_HEIGHT, 2)..') '
EgtOutLog( sOut)
EgtOutBox( sOut, 'Lavora Pareti', 'WARNING')
EgtDraw()
return false
end
-- Verifico dimensioni minime del grezzo
if dRawL < WD.MIN_LENGTH - 10 * GEO.EPS_SMALL or dRawW < WD.MIN_WIDTH - 10 * GEO.EPS_SMALL or dRawH < WD.MIN_HEIGHT - 10 * GEO.EPS_SMALL then
local sOut = 'Grezzo (' .. EgtNumToString( dRawL, 2) .. ' x ' .. EgtNumToString( dRawW, 2) .. ' x ' .. EgtNumToString( dRawH, 2) .. ') ' ..
'sotto il limite della macchina ('..EgtNumToString( WD.MIN_LENGTH, 2)..' x '..EgtNumToString( WD.MIN_WIDTH, 2)..' x '..EgtNumToString( WD.MIN_HEIGHT, 2)..')'
EgtOutLog( sOut)
EgtOutBox( sOut, 'Lavora Pareti', 'WARNING')
EgtDraw()
return false
end
-- Sistemo le pareti nel grezzo
return WE.ProcessWalls( dRawL, dRawW, dRawH, vWall)
end
-------------------------------------------------------------------------------------------------------------
-- *** Inserimento delle lavorazioni nelle travi ***
-------------------------------------------------------------------------------------------------------------
local function MyProcessFeatures()
local bOk, Stats = WE.ProcessFeatures()
local nErrCnt = 0
local nWarnCnt = 0
local sOutput = ''
for i = 1, #Stats do
if Stats[i].Err > 0 then
nErrCnt = nErrCnt + 1
sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, Stats[i].Msg)
elseif Stats[i].Err < 0 then
nWarnCnt = nWarnCnt + 1
sOutput = sOutput .. string.format( '[%d,%d] %s\n', Stats[i].CutId, Stats[i].TaskId, Stats[i].Msg)
end
end
if #sOutput > 0 then EgtOutLog( sOutput) end
if nErrCnt > 0 then
EgtOutBox( sOutput, 'Lavora Pareti', 'ERRORS')
EgtDraw()
return false
elseif nWarnCnt > 0 then
EgtOutBox( sOutput, 'Lavora Pareti', 'WARNINGS')
EgtDraw()
return true
end
return true
end
-------------------------------------------------------------------------------------------------------------
-- *** Esecuzione ***
-------------------------------------------------------------------------------------------------------------
if not MyProcessInputData() then return end
if not MyProcessWalls() then return end
-- Abilito Vmill
EgtSetInfo( EgtGetCurrMachGroup(), 'Vm', '1')
if not MyProcessFeatures() then return end
+31
View File
@@ -0,0 +1,31 @@
-- Swap.lua by Egaltech s.r.l. 2020/04/06
-- Gestione rotazione nel piano di una Parete
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
-- recupero il pezzo del primo oggetto selezionato
local nId = EgtGetFirstSelectedObj()
local nPartId = EgtGetParent( EgtGetParent( nId or GDB_ID.NULL) or GDB_ID.NULL)
if not nPartId or not EgtIsPart( nPartId) then
EgtOutBox( 'Nessuna parete selezionata', 'Rotate Parete', 'ERROR')
return
end
-- recupero il box del pezzo
local Ls = EgtGetFirstNameInGroup( nPartId, 'Box')
local b3Solid = EgtGetBBoxGlob( Ls or GDB_ID.NULL, GDB_BB.STANDARD)
if not b3Solid then
local sName = EgtGetName( nPartId) or ( 'Id=' .. tonumber( nPartId))
EgtOutBox( 'Box non definito per la parete ' .. sName, 'Rotate Parete', 'ERROR')
return
end
-- eseguo rotazione di 90 gradi attorno asse Z
EgtRotate( nPartId, b3Solid:getCenter(), Z_AX(), 90, GDB_RT.GLOB)
EgtDraw()
-- end
+8
View File
@@ -0,0 +1,8 @@
[Wall]
BtlEnable=1
BaseDir=C:\EgtData\Wall
BtlExec=BatchProcess.lua
Button1=Process.lua,Images\Process.png,Lavora Pareti
Button2=Rotate.lua,Images\Rotate.png,Ruota Parete
Button3=Overturn.lua,Images\Overturn.png,Ribalta Parete
Button4=WallMachinings,Images\WallMachinings.png,Lista lavorazioni
Binary file not shown.
File diff suppressed because it is too large Load Diff
+5
View File
@@ -0,0 +1,5 @@
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,11
[InternetShortcut]
IDList=
URL=https://www.design2machine.com/
@@ -0,0 +1,847 @@
; PIndex = Type, PName, Min, Max, Default, Description
; QIndex = Type, QName, Min, Max, Default, Description
; Type : d=double, l=length, s=string
[Processings]
0=10,12,13,16,17,20,25,30,32,33,34,36,37,38,39,40,50,51,52,53,55,56,60,61,80,90,100,101,102,103,104,106,107,120,136,138,250,251,252
1=10,11,30,35,50,55,70,71,80,136,138
;Cut
[1.10]
GRP=1,2
PRC=10
NAME=60951
P1=d,P01,-99999,99999,0,61001
P2=d,P02,0,50000,0,61002
P3=d,P03,0,50000,0,61003
P4=d,P06,0.1,179.9,90,61004
P5=d,P07,0.1,179.9,90,61005
QB1=d,Q04,0,1,0,0=Automatico 1=Non staccare scarto di taglio
QB2=d,Q05,0,1,0,0=Automatico 1=Lama + Truciolatore
QB3=l,Q06,0,40,0,61451, Profondità smusso
;Longitudinal Cut
[0.10]
GRP=0,3,4
PRC=10
NAME=60952
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,20,61002
P3=d,P04,0,7,0,61008
P4=d,P07,-90,90,45,61009
P5=d,P11,0,50000,0,61010
P6=d,P12,0,99999,0,61011
P7=d,P13,1,179,90,61012
P8=d,P14,1,179,90,61013
QB1=d,Q05,0,4,0,61500, 0=Automatico 1=Lama lungo faccia 2=Lama su fianchi e sotto 3=Lama su facce non passanti 4=Lama su fianchi e sotto su facce non passanti
QB2=d,Q07,0,1,0,61501, 0=Automatico 1=Lavorazione con fresa orizzontale se sopra o sotto (disabilita lama)
;Double Cut
[1.11]
GRP=1,2
PRC=11
NAME=60953
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,50,61015
P3=d,P06,1,179,45,61016
P4=d,P07,1,179,90,61017
P5=d,P08,1,179,90,61018
P6=d,P09,1,179,90,61019
QB1=l,Q06,0,40,0,61451, Profondità smusso
;Ridge or Valley Cut
[0.12]
GRP=0
PRC=12
NAME=60954
P1=d,P01,-99999,99999,0,61001
P2=d,P02,0,50000,50,61015
P3=d,P04,0,7,0,61008
P4=d,P07,-89,89,45,61023
P5=d,P09,-89,89,45,61024
P6=d,P11,-99999,99999,0,61025
P7=d,P12,0,99999,0,61011
P8=d,P13,1,179,90,61027
P9=d,P14,1,179,90,61028
P10=d,P15,1,179,90,61029
P11=d,P16,1,179,90,61030
QB1=d,Q01,0,1,0,61497, 0=Automatico 1=Lama
QB2=d,Q03,0,1,0,61502, 0=Automatico 1=Usa truciolatore se sotto
QW1=d,Q02,0,2,0,61504, 0=Automatico; 1=Esegui con lato fresa tipo lama; 2=Esegui con lato fresa tipo lama ma limita uso su facce sopra
;Saw Cut
[0.13]
GRP=0,3,4
PRC=13
NAME=60955
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,0,61015
P3=d,P03,-50000,50000,0,61033
P4=d,P06,-180,180,90,61004
P5=d,P07,1,179,90,61009
P6=d,P08,-89,89,0,61036
P7=d,P11,0,50000,50,61037
P8=d,P12,1,99999,50,61038
QB1=d,Q01,0,1,0,61503, 0=Attacco e uscita centrati 1=Attacco e uscita interni
QB2=d,Q02,0,1,0,61505, 0=Automatico; 1=Lavora come Taglio Longitudinale
;Slot
[0.16]
GRP=3,4
PRC=16
NAME=60956
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,0,61002
P3=d,P03,0,50000,0,61041
P4=d,P04,0,63,0,61042
P5=d,P06,-90,90,0,61043
P6=d,P07,1,179,90,61009
P7=d,P08,1,179,90,61045
P8=d,P09,1,179,90,61046
P9=d,P10,1,179,0,61047
P10=d,P11,1,50000,100,61048
P11=d,P12,1,99999,200,61049
P12=d,P13,1,50000,10,61050
P13=d,P14,-50000,50000,0,61051
P14=d,P15,-50000,50000,0,61052
QB1=d,Q01,0,1,0,61497, 0=Automatico; 1=Lama
QB2=l,Q04,0,40,0,61451, Profondità smusso
QB3=d,Q05,0,1,0,61457, 1=Solo smusso
QB4=d,Q10,0,500,0,61496, Massima elevazione (0=Automatico, altrimenti manuale)
QW1=d,Q03,0,2,0,61504, 0=Automatico; 1=Esegui con lato fresa tipo lama; 2=Esegui con lato fresa tipo lama ma limita uso su facce sopra
;Front Slot
[0.17]
GRP=3,4
PRC=17
NAME=60957
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,0,61015
P3=d,P03,0,50000,0,61055
P4=d,P04,0,63,0,61056
P5=d,P06,1,179,90,61004
P6=d,P07,1,179,90,61009
P7=d,P08,0,360,90,61059
P8=d,P11,0,50000,20,61060
P9=d,P12,0,50000,40,61061
P10=d,P13,0,50000,40,61062
;Birds Mouth
[0.20]
GRP=3,4
PRC=20
NAME=60958
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,0,61002
P3=d,P04,-1,12,-1,61065
P4=d,P05,0,1,0,61066
P5=d,P06,1,179,90,61067
P6=d,P07,0,180,45,61068
P7=d,P08,0,180,135,61069
P8=d,P09,0,179,0,61070
P9=d,P10,0,179,0,61071
P10=d,P11,0,50000,20,61072
P11=d,P12,0,50000,20,61073
P12=d,P13,0,50000,0,61074
P13=d,P14,0,50000,0,61075
P14=d,P15,0,50000,0,61076
QB1=l,Q01,0,30,0,61451, Profondità smusso
QB2=d,Q02,0,1,0,61506, 0=Automatico 1=Lavorazione con fresa
QB3=d,Q03,0,1,0,61485, 0=Automatico; 1=Truciolatore
;Hip or Valley Rafter Notch
[0.25]
GRP=3,4
PRC=25
NAME=60959
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,0,61002
P3=d,P05,0,1,0,61079
P4=d,P06,1,179,45,61080
P5=d,P07,1,179,45,61081
P6=d,P08,0,180,30,61082
P7=d,P11,0,50000,20,61083
P8=d,P14,0,50000,0,61084
P9=d,P15,0,50000,0,61085
;Ridge Lap
[1.30]
GRP=1,2
PRC=30
NAME=60960
P1=d,P01,-99999,99999,0,61001
P2=d,P02,0,1,0,61087
P3=d,P06,1,179,90,61088
P4=d,P11,1,50000,50,61089
P5=d,P12,1,50000,100,61090
P6=d,P13,0,1000,0,61091
QB1=l,Q01,0,30,0,61451, Profondità smusso
;Lap Joint
[0.30]
GRP=3,4
PRC=30
NAME=60961
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,0,61002
P3=d,P03,0,50000,0,61094
P4=d,P04,0,63,0,61095
P5=d,P06,1,179,90,61096
P6=d,P07,1,179,90,61009
P7=d,P08,-89,89,0,61098
P8=d,P09,0,179,0,61099
P9=d,P10,0,179,0,61100
P10=d,P11,-50000,50000,50,61101
P11=d,P12,1,99999,100,61102
P12=d,P13,0,89,0,61103
P13=d,P14,0,50000,0,61104
QB1=d,Q01,0,2,0,61460, 0=Automatico; 1=Esegui perimetro con fresa diametro minore; 2=Pulitura solo su angoli
QB2=d,Q02,0,1,0,61470, 0=Automatico; 1=Solo contorno
QB3=d,Q03,0,1,0,61455, 0=Automatico; 1=Lavorazione con fresa di lato
QB4=d,Q04,0,4,0,61499, 0=Automatico; 1=Lama lungo faccia 2=Lama su fianchi e sotto 3=Lama su facce non passanti 4=Lama su fianchi e sotto su facce non passanti
QB5=d,Q06,0,2,0,61467, Antischeggia: 0=No; 1=Con lama; 2=Con fresa
QB6=l,Q07,0,30,0,61451, Profondità smusso
QB7=d,Q10,0,500,0,61496, Massima elevazione (0=Automatico, altrimenti manuale)
QW1=d,Q05,0,3,0,61469, Pulisci spigoli: 0=No; 1=Con fresa conica dopo rimozione manuale sfridi; 2=Con fresa conica piccola;3=Con gola di scarico
QW2=d,Q08,0,2,0,61504, 0=Automatico; 1=Esegui con lato fresa tipo lama; 2=Esegui con lato fresa tipo lama ma limita uso su facce sopra
;Notch/Rabbet
[0.32]
GRP=3,4
PRC=32
NAME=60962
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,0,61002
P3=d,P04,0,63,0,61107
P4=d,P11,0,50000,20,61108
P5=d,P12,0,99999,20,61109
P6=d,P13,1,50000,200,61110
QB1=d,Q01,0,1,0,61455, 0=Automatico 1=Lavorazione con fresa di lato
QB2=d,Q02,0,2,0,61460, 0=Automatico; 1=Esegui perimetro con fresa diametro minore; 2=Pulitura solo su angoli
QB3=d,Q06,0,2,0,61467, Antischeggia : 0=No; 1=Con lama; 2=Con fresa
QB4=d,Q10,0,500,0,61496, Massima elevazione (0=Automatico, altrimenti manuale)
QW1=d,Q03,0,2,0,61504, 0=Automatico; 1=Esegui con lato fresa tipo lama; 2=Esegui con lato fresa tipo lama ma limita uso su facce sopra
QW2=d,Q05,0,3,0,61469, Pulisci spigoli: 0=No; 1=Con fresa conica dopo rimozione manuale sfridi; 2=Con fresa conica piccola;3=Con gola di scarico
;Block House Half Lap, Stairs Riser Dado
[0.33]
GRP=3,4
PRC=33
NAME=60963
P1=d,P01,-99999,99999,0,61001
P2=d,P06,1,179,90,61004
P3=d,P11,0,50,20,61113
P4=d,P12,0,50,20,61114
P5=d,P13,1,50000,50,61115
QB1=d,Q06,0,2,0,61467, Antischeggia : 0=No; 1=Con lama; 2=Con fresa
;Seathing Cut
[0.34]
GRP=3,4
PRC=34
NAME=60964
P1=d,P01,-99999,99999,0,61001
P2=d,P11,0,99999,1,61117
P3=d,P12,1,99999,500,61118
QB1=d,Q01,0,2,0,61460, 0=Automatico; 1=Esegui perimetro con fresa diametro minore; 2=Pulitura solo su angoli
QB2=d,Q06,0,2,0,61467, Antischeggia : 0=No; 1=Con lama; 2=Con fresa
QB3=d,Q10,0,500,0,61496, Massima elevazione (0=Automatico, altrimenti manuale)
;French Ridge Lap
[1.35]
GRP=1,2
PRC=35
NAME=60965
P1=d,P01,-99999,99999,0,61001
P2=d,P02,0,1,0,61120
P3=d,P06,1,179,90,61121
P4=d,P13,0,1000,0,61122
;Chamfer
[0.36]
GRP=3,4
PRC=36
NAME=60966
P1=d,P01,-99999,99999,0,61001
P2=d,P04,0,15,1,61124
P3=d,P11,1,50,10,61125
P4=d,P12,0,99999,500,61126
P5=d,P15,0,2,0,61127
QB1=d,Q01,0,6,0,61489, Numero divisioni ondulazioni dello smusso sulla lunghezza
;Block House Half Lap
[0.37]
GRP=4
PRC=37
NAME=60967
P1=d,P01,-99999,99999,0,61001
P2=d,P03,0,50000,0,61129
P3=d,P04,0,2,0,61130
P4=d,P05,0,1,0,61131
P5=d,P08,0,50000,10,61132
P6=d,P09,0,50000,100,61133
P7=d,P10,0,50000,10,61134
P8=d,P11,0,50000,100,61135
P9=d,P12,0,50000,10,61136
P10=d,P13,0,50000,100,61137
P11=d,P14,0,50000,10,61138
P12=d,P15,0,50000,100,61139
P13=d,P16,0,50000,50,61140
P14=d,P17,0,50000,50,61141
P15=d,P18,0,50000,50,61142
P16=d,P19,0,15,0,61143
QB1=d,Q06,0,2,0,61467, Antischeggia: 0=No; 1=Con lama; 2=Con fresa
;Block House Front
[0.38]
GRP=3,4
PRC=38
NAME=60968
P1=d,P01,-99999,99999,0,61001
P2=d,P04,0,1,0,61145
P3=d,P06,1,179,90,61146
P4=d,P11,-50000,50000,15,61147
P5=d,P12,-50000,50000,10,61148
P6=d,P13,-50000,50000,25,61149
P7=d,P15,0,50000,100,61150
;Pocket
[0.39]
GRP=4
PRC=39
NAME=60969
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,0,61002
P3=d,P04,0,63,0,61153
P4=d,P06,-179,179,0,61154
P5=d,P07,-179,179,0,61155
P6=d,P08,-179,179,0,61156
P7=d,P10,1,179,90,61157
P8=d,P11,-50000,50000,20,61158
P9=d,P12,1,50000,20,61159
P10=d,P13,0,50000,100,61160
QB1=d,Q01,0,2,0,61460, 0=Automatico; 1=Esegui perimetro con fresa diametro minore; 2=Pulitura solo su angoli
QB2=d,Q02,0,1,0,61506, 0=Automatico 1=Lavorazione con fresa
QB3=d,Q06,0,2,0,61467, Antischeggia : 0=No; 1=Con lama; 2=Con fresa
QW1=d,Q03,0,2,0,61504, 0=Automatico; 1=Esegui con lato fresa tipo lama; 2=Esegui con lato fresa tipo lama ma limita uso su facce sopra
QW2=d,Q05,0,3,0,61469, Pulisci spigoli: 0=No; 1=Con fresa conica dopo rimozione manuale sfridi; 2=Con fresa conica piccola;3=Con gola di scarico
;Drilling
[0.40]
GRP=3,4
PRC=40
NAME=60970
P1=d,P01,-99999,99999,50,61001
P2=d,P02,-50000,50000,50,61002
P3=d,P03,-99999,99999,0,61163
P4=d,P06,0,360,90,61164
P5=d,P07,1,179,90,61165
P6=d,P11,0,50000,50,61166
P7=d,P12,0,50000,20,61167
QB1=d,Q01,0,1,0,61470, 0=Automatico; 1=Solo contorno ; 2=Svuota
QB2=d,Q02,0,1,0,61471, 0=Automatico; 1=Fora da un solo lato
QW1=d,Q01,0,1,0,61470, 0=Automatico; 1=Solo contorno ; 2=Svuota
;Tenon
[1.50]
GRP=1,2
PRC=50
NAME=60971
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,50,61002
P3=d,P04,0,4,0,61170
P4=d,P05,0,1,0,61171
P5=d,P06,1,179,90,61004
P6=d,P07,1,179,90,61005
P7=d,P08,1,179,90,61174
P8=d,P10,0,500,0,61175
P9=d,P11,1,1000,40,61176
P10=d,P12,1,1000,40,61177
P11=d,P14,-50000,50000,0,61178
P12=d,P15,-50000,50000,0,61179
QB1=l,Q01,0,30,0,61451, Profondità smusso
QB2=l,Q02,0,30,0,61475, Riduzione profondità tenone
QB3=l,Q03,0,30,0,61476, Riduzione larghezza tenone
QB4=l,Q04,0,30,0,61477, Riduzione altezza tenone
;Mortise
[0.50]
GRP=3,4
PRC=50
NAME=60972
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,50,61002
P3=d,P03,0,50000,0,61182
P4=d,P04,0,4,0,61183
P5=d,P06,-180,180,90,61184
P6=d,P07,1,179,90,61185
P7=d,P08,1,179,90,61186
P8=d,P10,0,500,0,61187
P9=d,P11,0,1000,40,61188
P10=d,P12,0,1000,40,61189
P11=d,P13,1,50000,200,61190
P12=d,P14,-50000,50000,0,61191
P13=d,P15,-50000,50000,0,61192
P14=d,P16,1,179,90,61193
;Mortise Front
[0.51]
GRP=3,4
PRC=51
NAME=60973
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,50,61002
P3=d,P04,0,4,90,61196
P4=d,P06,1,179,90,61004
P5=d,P07,1,179,90,61005
P6=d,P08,1,179,90,61199
P7=d,P10,0,500,0,61200
P8=d,P11,1,1000,40,61201
P9=d,P12,1,1000,40,61202
P10=d,P14,-50000,50000,0,61203
P11=d,P15,-50000,50000,0,61204
;House
[0.52]
GRP=3,4
PRC=52
NAME=60974
P1=d,P01,-99999,99999,0,61168
P2=d,P02,-50000,50000,50,61169
P3=d,P04,0,4,90,61170
P4=d,P06,1,179,90,61172
P5=d,P07,1,179,90,61173
P6=d,P08,1,179,90,61174
P7=d,P09,0,99999,0,61205
P8=d,P10,0,500,0,61175
P9=d,P11,1,1000,40,61176
P10=d,P12,1,1000,40,61177
P11=d,P14,-50000,50000,0,61178
P12=d,P15,-50000,50000,0,61179
;House Mortise
[0.53]
GRP=3,4
PRC=53
NAME=60975
P1=d,P01,-99999,99999,0,61180
P2=d,P02,-50000,50000,50,61181
P3=d,P03,0,50000,0,61182
P4=d,P04,0,4,90,61183
P5=d,P06,-180,180,90,61184
P6=d,P07,1,179,90,61185
P7=d,P08,1,179,90,61186
P8=d,P09,0,99999,0,61206
P9=d,P10,0,500,0,61187
P10=d,P11,0,1000,40,61188
P11=d,P12,0,1000,40,61189
P12=d,P13,1,50000,200,61190
P13=d,P14,-50000,50000,0,61191
P14=d,P15,-50000,50000,0,61192
P15=d,P16,1,179,90,61193
;Dovetail Tenon
[1.55]
GRP=1,2
PRC=55
NAME=60976
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,50,61002
P3=d,P04,0,1,0,61209
P4=d,P06,1,179,90,61210
P5=d,P07,1,179,90,61005
P6=d,P08,1,179,90,61212
P7=d,P09,0,1000,0,61213
p8=d,P10,0,30,0,61214
P9=d,P11,1,1000,28,61215
P10=d,P12,-1000,1000,45,61216
P11=d,P14,-50000,50000,0,61217
P12=d,P15,-50000,50000,0,61218
QB1=l,Q03,0,30,0,61475, Riduzione profondità tenone
QB2=l,Q04,0,30,0,61479, Ridurre/Allargare sagoma tenone
QB3=l,Q05,0,30,0,61480, Ridurre/Allargare altezza tenone
;Dovetail Mortise
[0.55]
GRP=3,4
PRC=55
NAME=60977
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,50,61002
P3=d,P03,0,50000,0,61221
P4=d,P04,0,1,0,61222
P5=d,P05,0,1,0,61223
P6=d,P06,-180,180,0,61224
P7=d,P07,1,179,90,61225
P8=d,P09,0,1000,0,61226
P9=d,P10,0,30,0,61227
P10=d,P11,1,1000,28,61228
P11=d,P12,-1000,1000,45,61229
p12=d,P13,1,50000,200,61230
p13=d,P14,-50000,50000,0,61231
p14=d,P15,-50000,50000,0,61232
;Dovetail Mortise Front
[0.56]
GRP=3,4
PRC=56
NAME=60978
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,50,61002
P3=d,P03,0,50000,0,61235
P4=d,P04,0,1,0,61236
P5=d,P05,0,1,0,61237
P6=d,P06,1,179,90,61004
P7=d,P07,1,179,90,61005
P8=d,P08,1,179,90,61240
P9=d,P09,0,1000,0,61241
P10=d,P10,0,30,0,61242
P11=d,P11,1,1000,28,61243
P12=d,P12,0,1000,45,61244
P13=d,P14,-50000,50000,0,61245
P14=d,P15,-50000,50000,0,61246
;Marking/Labeling
[0.60]
GRP=3,4
PRC=60
NAME=60979
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,0,61002
P3=d,P04,0,19521,0,61249
P4=d,P06,1,180,90,61250
P5=d,P07,0,179,90,61251
P6=d,P11,0,50000,100,61252
P7=d,P12,0,50000,0,61253
P8=d,P13,0,50000,200,61254
P9=s,P15,,,,61255
;Text
[0.61]
GRP=4
PRC=61
NAME=60980
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,0,61002
P3=d,P06,-180,180,0,61258
P4=d,P09,0,2,0,61259
P5=d,P10,0,2,0,61260
P6=d,P11,0,2,0,61261
P7=d,P12,0,1,0,61262
P8=d,P13,0,50000,200,61263
P9=s,P15,,,,61255
;Simple Scarf
[1.70]
GRP=1,2
PRC=70
NAME=60981
P1=d,P01,-50000,50000,0,61001
P2=d,P11,0,50000,20,61266
P3=d,P12,0,50000,20,61267
P4=d,P13,1,50000,200,61268
P5=d,P14,0,1000,0,61269
P6=d,P15,0,1000,0,61270
QB1=l,Q01,0,30,0,61451, Profondità smusso
;Scarf Joint
[1.71]
GRP=1,2
PRC=71
NAME=60982
P1=d,P01,-99999,99999,0,61001
P2=d,P07,0,90,0,61272
P3=d,P09,-,1,1,1,61273
P4=d,P10,0,50000,0,61274
P5=d,P11,1,50000,20,61275
P6=d,P12,0,50000,0,61276
P7=d,P13,1,50000,200,61277
P8=d,P14,0,1000,0,61278
P9=d,P15,0,1000,0,61279
QB1=l,Q01,0,30,0,61451, Profondità smusso
QB2=l,Q04,0,30,0,61484, Aumenta dimensioni P10
;Step Joint
[1.80]
GRP=1,2
PRC=80
NAME=60983
P1=d,P01,-99999,99999,0,61001
P2=d,P04,0,1,0,61281
P3=d,P07,1,179,45,61282
P4=d,P11,0,1000,20,61283
P5=d,P12,0,1000,20,61284
P6=d,P14,0,1000,0,61285
P7=d,P15,0,1000,0,61286
QB1=l,Q01,0,30,0,61451, Profondità smusso
QB2=d,Q02,0,1,0,61485, 0=Automatico; 1=Truciolatore
QB3=l,Q03,0,20,0,61486, Riduzione lunghezza P14
QB4=l,Q04,0,20,0,61487, Riduzione larghezza P15
;Step Joint Notch
[0.80]
GRP=3,4
PRC=80
NAME=60984
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,0,61002
P3=d,P04,0,1,0,61289
P4=d,P07,1,179,45,61290
P5=d,P10,0,50000,50,61291
P6=d,P11,0,1000,20,61292
P7=d,P12,0,1000,20,61293
P8=d,P13,1,50000,200,61294
P9=d,P14,0,1000,0,61295
P10=d,P15,0,1000,0,61296
;Planing
[0.90]
GRP=3,4
PRC=90
NAME=60985
P1=d,P01,-99999,99999,0,61001
P2=d,P04,1,15,15,61298
P3=d,P11,0,50,1,61299
P4=d,P12,-99999,99999,500,61300
;Profile Front
[0.100]
GRP=3,4
PRC=100
NAME=60986
P1=d,P01,-99999,99999,0,61001
P2=d,P03,-1000,1000,0,61002
P3=d,P06,0,180,90,61303
P4=d,P07,0,180,90,61304
P5=d,P08,-180,180,0,61305
P6=d,P11,-1000,1000,250,61306
P7=d,P12,-1000,1000,250,61307
QB1=l,Q01,0,10,0,61451, Profondità smusso
QB2=l,Q02,0,20,0,61488, Sovramateriale finitura
QB3=d,Q03,0,1,0,Solo smusso (1=si, 0=no)
;Profile Head concave
[0.101]
GRP=3,4
PRC=101
NAME=60987
P1=d,P01,-99999,99999,0,61001
P2=d,P11,0,1000,120,61309
P3=d,P12,-1000,1000,20,61310
P4=d,P13,0,1000,20,61311
P5=d,P14,-1000,1000,20,61312
P6=d,P15,0,1000,20,61313
QB1=l,Q01,0,10,0,61451, Profondità smusso
QB2=l,Q02,0,20,0,61488, Sovramateriale finitura
QB3=d,Q03,0,1,0,61490, 1=Disabilita fresatura gradini
QB4=d,Q04,0,1,0,Solo smusso (1=si, 0=no)
;Profile Head convex
[0.102]
GRP=3,4
PRC=102
NAME=60988
P1=d,P01,-99999,99999,0,61001
P2=d,P11,0,1000,120,61315
P3=d,P12,-1000,1000,20,61316
P4=d,P13,0,1000,20,61317
P5=d,P14,-1000,1000,20,61318
P6=d,P15,0,1000,20,61319
QB1=d,Q01,0,1,0,61457, 1=Solo smusso
QB2=l,Q02,0,30,0,61451, Profondità smusso
QB3=l,Q04,0,20,0,61488, Sovramateriale finitura
QB4=d,Q05,0,1,0,61490, 1=Disabilita fresatura gradini
;Profile Head cambered
[0.103]
GRP=3,4
PRC=103
NAME=60989
P1=d,P01,-99999,99999,0,61001
P2=d,P10,0,50000,500,61321
P3=d,P11,-1000,1000,40,61322
P4=d,P12,-1000,1000,60,61323
P5=d,P13,-1000,1000,10,61324
P6=d,P14,-1000,1000,40,61325
P7=d,P15,0,1,1,61326
QB1=d,Q01,0,1,0,61491, 1=Attiva smusso superiore
QB2=d,Q02,0,1,0,61492, 1=Smusso superiore con lama
QB3=l,Q03,0,30,0,61451, Profondità smusso
QB4=l,Q04,0,20,0,61488, Sovramateriale finitura
QB5=d,Q05,0,1,0,61457, 1=Solo smusso
;Round Arch
[0.104]
GRP=4
PRC=107
NAME=60990
P1=d,P01,-99999,99999,0,61001
P2=d,P11,-1000,1000,30,61328
P3=d,P12,0,30000,500,61329
QB1=l,Q01,0,20,0,61488, Sovramateriale finitura
QB2=l,Q02,0,50,8,61493, Spessore legno per supporto lavorazione
QB3=l,Q03,0,30,0,61451, Profondità smusso
;Profile Head
[0.106]
GRP=3,4
PRC=106
NAME=60991
P1=d,P01,-99999,99999,0,61001
P2=d,P04,0,3,0,61331
P3=d,P09,0,1000,20,61332
P4=d,P10,0,1000,20,61333
P5=d,P11,0,1000,10,61334
P6=d,P12,0,1000,50,61335
P7=d,P13,0,1000,50,61336
P8=d,P14,0,1000,15,61337
P9=d,P15,0,1000,20,61338
P10=d,P16,0,1000,20,61339
P11=d,P17,0,1000,10,61340
P12=d,P18,0,1000,50,61341
P13=d,P19,0,1000,50,61342
P14=d,P20,0,1000,15,61343
P15=d,P21,0,1000,20,61344
P16=d,P22,0,1000,30,61345
QB1=l,Q01,0,30,0,61451, Profondità smusso
QB2=d,Q02,0,1,0,61457, 1=Solo smusso
QB3=d,Q03,0,1,0,61490, 1=Disabilita fresatura gradini
QB4=l,Q04,0,20,0,61488, Sovramateriale finitura
;Sphere
[0.107]
GRP=3,4
PRC=107
NAME=60992
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-99999,99999,50,61002
P3=d,P03,-99999,99999,50,61348
P4=d,P11,-99999,99999,50,61349
P5=d,P12,0,99999,0,61350
P6=d,P13,0,99999,P11,61351
;Triangle Cut
[0.120]
GRP=4
PRC=120
NAME=60993
P1=d,P01,-99999,99999,0,61001
P2=d,P02,-50000,50000,0,61002
P3=d,P03,-50000,50000,0,61354
P4=d,P10,-50000,50000,1,61355
P5=d,P11,-50000,50000,0,61356
P6=d,P12,-50000,50000,1,61357
P7=d,P13,-50000,50000,-1,61358
P8=d,P14,-50000,50000,0,61359
P9=d,P15,-50000,50000,1,61360
;Tyrolean Dovetail
[1.136]
GRP=1,2
PRC=136
NAME=60994
P1=d,P01,-99999,99999,0,61001
P2=d,P02,0,50000,30,61362
P3=d,P03,-50000,50000,50,61363
P4=d,P04,0,1,0,61364
P5=d,P05,-1,50000,0,61365
P6=d,P06,1,179,90,61366
P7=d,P07,0,50000,0,61367
P8=d,P08,0,50000,0,61368
P9=d,P09,0,45,15,61369
P10=d,P11,0,50000,25,61370
P11=d,P12,0,50000,0,61371
P12=d,P13,0,50000,0,61372
P13=d,P14,0,1,0,61373
P14=d,P15,0,50000,50,61374
P15=d,P16,0,2,0,61375
;Tyrolean Dovetail
[0.136]
GRP=3,4
PRC=136
NAME=60994
P1=d,P01,-99999,99999,0,61001
P2=d,P02,0,50000,30,61362
P3=d,P03,-50000,50000,50,61363
P4=d,P04,0,1,0,61364
P5=d,P05,-1,50000,0,61365
P6=d,P06,1,179,90,61366
P7=d,P07,0,50000,0,61367
P8=d,P08,0,50000,0,61368
P9=d,P09,0,45,15,61369
P10=d,P11,0,50000,25,61370
P11=d,P12,0,50000,0,61371
P12=d,P13,0,50000,0,61372
P13=d,P14,0,1,0,61373
P14=d,P15,0,50000,50,61374
P15=d,P16,0,2,0,61375
;Dovetail
[1.138]
GRP=1,2
PRC=138
NAME=60995
P1=d,P01,-99999,99999,0,61001
P2=d,P02,0,50000,30,61377
P3=d,P03,-50000,50000,50,61378
P4=d,P04,0,1,0,61379
P5=d,P05,-1,50000,0,61380
P6=d,P09,0,45,15,61381
P7=d,P11,0,50000,40,61382
P8=d,P12,0,50000,20,61383
P9=d,P14,0,1,0,61384
P10=d,P15,0,50000,50,61385
P11=d,P16,0,2,0,61386
;Dovetail
[0.138]
GRP=3,4
PRC=138
NAME=60995
P1=d,P01,-99999,99999,0,61001
P2=d,P02,0,50000,30,61377
P3=d,P03,-50000,50000,50,61378
P4=d,P04,0,1,0,61379
P5=d,P05,-1,50000,0,61380
P6=d,P09,0,45,15,61381
P7=d,P11,0,50000,40,61382
P8=d,P12,0,50000,20,61383
P9=d,P14,0,1,0,61384
P10=d,P15,0,50000,50,61385
P11=d,P16,0,2,0,61386
;Free Contour
[0.250]
GRP=0,3,4
PRC=250
NAME=60996
P1=d,P05,0,50000,0,61387
P2=d,P07,0,1,0,61388
P3=d,P13,0,200,0,61389
P4=d,P14,0,10000,0,61390
P5=d,P15,0,1000,0,61391
QB1=l,Q01,0,50,0,61493, Spessore legno per supporto lavorazione
QB2=l,Q02,0,30,0,61451, Profondità smusso
QB3=l,Q03,0,20,0,61488, Sovramateriale finitura
QW1=d,Q05,0,3,0,61469, Pulisci spigoli: 0=No; 1=Con fresa conica dopo rimozione manuale sfridi; 2=Con fresa conica piccola;3=Con gola di scarico
;Outline
[0.251]
GRP=4
PRC=251
NAME=60997
P1=d,P13,0,200,0,61389
P2=d,P14,0,10000,0,61390
P3=d,P15,0,1000,0,61391
QW1=d,Q05,0,3,0,61469, Pulisci spigoli: 0=No; 1=Con fresa conica dopo rimozione manuale sfridi; 2=Con fresa conica piccola;3=Con gola di scarico
;Aperture
[0.252]
GRP=4
PRC=252
NAME=60998
P1=d,P13,0,200,0,61389
P2=d,P14,0,10000,0,61390
P3=d,P15,0,1000,0,61391
QW1=d,Q05,0,3,0,61469, Pulisci spigoli: 0=No; 1=Con fresa conica dopo rimozione manuale sfridi; 2=Con fresa conica piccola;3=Con gola di scarico
@@ -0,0 +1,255 @@
; DisplayIndex = Name, CanUserReorder, CanUserResize, CanUserSort, IsReadOnly, Width, DataGridLengthUnitType, Visible, CanUserEditVisible
[DG_FeatureList]
0=colDO,1,1,1,0,30.4,1,1,1,0
1=colCALC,0,1,0,0,32.8,1,1,1,0
2=colDESC,1,1,1,1,1,4,1,1,0
[DG_OpenProjectFileDialog_PROJ]
0=colPROJID,1,1,1,1,34,1,1,1,0
1=colBTLNAME,1,1,1,1,170,1,1,1,0
2=colLISTNAME,1,1,1,1,79,1,1,1,0
3=colEXPDATE,1,1,1,1,56,1,1,1,0
4=colCRTDATE,1,1,1,1,113.8,1,1,1,0
5=colMACHINE,1,1,1,1,20,1,1,1,0
[DG_OpenProjectFileDialog_PROD]
0=colPRODID,1,1,1,1,54.4,1,1,1,0
1=colBTLNAME,1,1,1,1,154.850564,1,1,1,0
2=colCRTDATE,1,1,1,1,144.698873,1,1,1,0
3=colMACHINE,1,1,1,1,1,4,1,1,0
[DG_RawPartList_BEAM]
0=colNAME,1,1,1,1,28.8,1,1,1,0
1=colCALC,1,1,0,0,22.05,1,1,1,0
2=colSTARTCUT,1,1,1,0,95.993333,1,1,1,0
3=colW,1,1,1,0,40.4,1,1,1,0
4=colH,1,1,1,1,36.4,1,1,1,0
5=colL,1,1,1,0,60,1,1,1,0
6=colMATERIAL,1,1,1,1,102.643333,1,1,1,0
7=colUSAGE,1,1,1,1,92.913333,1,1,1,0
8=colWASTE,1,1,1,1,1,4,1,1,0
[DG_RawPartList_WALL]
0=colNAME,1,1,1,1,33.68,1,1,1,0
1=colCALC,1,1,0,0,22.05,1,1,1,0
2=colW,1,1,1,0,52.2,1,1,1,0
3=colH,1,1,1,1,52.2,1,1,1,0
4=colL,1,1,1,0,49,1,1,1,0
5=colMATERIAL,1,1,1,1,105.6,1,1,1,0
6=colUSAGE,1,1,1,1,197.8,1,1,1,0
7=colWASTE,1,1,1,1,1,4,1,1,0
[DG_PartInRawPartList_BEAM]
0=colPDN,0,0,0,1,33.68,1,1,1,0
1=colCALC,0,0,0,0,22.05,1,1,1,0
2=colNAM,0,0,0,1,65,1,1,1,0
3=colW,0,0,0,1,52.2,1,1,1,0
4=colH,0,0,0,1,52.2,1,1,1,0
5=colL,0,0,0,1,49,1,1,1,0
6=colOFFSET,0,0,0,0,361,1,0,0
7=colMATERIAL,0,0,0,1,20,1,1,1,0
8=colGROUP,0,1,0,1,122.6,1,1,0,0
9=colSTOREY,0,1,0,1,1,4,1,0,0
[DG_PartInRawPartList_WALL]
0=colPDN,0,0,0,1,33.68,1,1,1,0
1=colCALC,0,0,0,0,22.05,1,1,1,0
2=colNAM,0,0,0,1,65,1,1,1,0
3=colW,0,0,0,1,52.2,1,1,1,0
4=colH,0,0,0,1,52.2,1,1,1,0
5=colL,0,0,0,1,49,1,1,1,0
6=colROT,0,0,0,0,105.6,1,1,0,0
7=colFLIP,0,0,0,0,197.8,1,1,0,0
8=colPOSX,0,0,0,0,43.216477,1,1,0,0
9=colPOSY,0,0,0,0,43.216477,1,1,0,0
10=colMATERIAL,0,0,0,1,20,1,1,1,0
11=colGROUP,0,0,0,1,131.6,1,1,0,0
12=colSTOREY,0,0,0,1,1,4,1,0,0
[DG_PartList]
0=colPDN,0,0,1,1,35.28,1,1,0,1
1=colCALC,0,1,0,1,41.68,1,1,0,0
2=colDO,0,0,0,0,24.08,1,1,0,0
3=colW,0,1,0,1,39.88,1,1,0,0
4=colH,0,1,0,1,34.48,1,1,0,0
5=colL,0,1,0,1,45.08,1,1,0,0
6=colNAM,0,1,0,1,72.68,1,1,0,0
7=colMATERIAL,0,1,0,1,61.68,1,1,0,0
8=colCNT,0,1,0,1,35.88,1,1,0,0
9=colADDED,0,1,0,0,26.68,1,1,0,0
10=colINPROD,0,1,0,1,28.48,1,1,0,0
11=colDONE,0,1,0,1,30,1,1,0,0
12=colGROUP,0,0,0,1,126.6,1,1,0,0
13=colSTOREY,0,1,0,1,66.455633,1,1,0,0
[DG_FeatureInPartInRawPartList]
0=colDO,0,0,0,0,30.4,1,1,0,0
1=colCALC,0,0,0,0,28.8,1,1,0,0
2=colDESC,0,0,0,1,1,4,1,0,0
[DG_Statistics]
0=colPDN,0,0,0,1,35.28,1,1,0
1=colW,0,0,0,1,41.68,1,1,0
2=colH,0,0,0,1,44.08,1,1,0
3=colL,0,0,0,1,48.08,1,1,0
4=colDESC,0,0,0,1,285.28,1,1,0
5=colMATERIAL,0,0,0,1,63.68,1,1,0
6=colCNT,0,0,0,1,54.88,1,1,0
7=colADDED,0,0,0,0,55.68,1,1,0
8=colINPROD,0,0,0,1,84.48,1,1,0
9=colDONE,0,0,0,1,56,1,1,0
10=colUNITVOLUME,0,0,0,1,108,1,1,0
11=colTOTVOLUME,0,0,0,1,114.08,1,1,0
12=colUNITTIME,0,0,0,1,98.08,1,1,0
13=colTOTTIME,0,0,0,1,57.6,4,1,0
[DG_OptimizerStatistics]
0=colNAME,0,0,0,1,39.28,1,1,0
1=colW,0,0,0,1,69.68,1,1,0
2=colH,0,0,0,1,70.48,1,1,0
3=colL,0,0,0,1,64.08,1,1,0
4=colMATERIAL,0,0,0,1,248.48,1,1,0
5=colUSAGE,0,0,0,1,268.48,1,1,0
6=colWASTE,0,0,0,1,248.72,1,1,0
7=colUNITTIME,0,0,0,1,98.08,4,1,0
[DG_RawPartStatistics]
0=colW,0,0,0,1,69.68,1,1,0
1=colH,0,0,0,1,70.48,1,1,0
2=colL,0,0,0,1,64.08,1,1,0
3=colMATERIAL,0,0,0,1,248.48,4,1,0
4=colQTY,0,0,0,1,98.08,1,1,0
[DG_BeamMachinings]
0=colON,0,0,0,0,29.6,1,1,0,0
1=colNAME,0,0,0,0,211.2,1,1,0,0
2=colTYPE,0,0,0,0,1,4,1,0,0
[DG_RawPartList_SUPERVISOR]
0=colNAME,0,0,0,1,33.8,1,1,0,0
1=colPRODUCE,0,0,0,0,28,1,1,0,0
2=colCALC,0,0,0,0,26.4,1,1,0,0
3=colPRODUCTION,0,0,0,0,24.8,1,1,0,0
4=colSTARTCUT,0,0,0,1,66.4,1,1,0,0
5=colW,0,0,0,1,52.2,1,1,0,0
6=colH,0,0,0,1,47.52,1,1,0,0
7=colL,0,0,0,1,43.52,1,1,0,0
8=colMATERIAL,0,0,0,1,69.72,1,1,0,0
9=colUSAGE,0,0,0,1,68.32,1,1,0,0
10=colWASTE,0,0,0,1,1,4,1,0,0
[DG_PartInRawPartList_SUPERVISOR]
0=colREDO,0,0,0,0,28.8,1,0,0
1=colPDN,0,0,0,1,24.32,1,1,0,0
2=colCALC,0,0,0,0,22.05,1,1,0,0
3=colPRODUCTION,0,0,0,0,22.05,1,1,0,0
4=colNAM,0,0,1,1,47.52,1,1,0,0
5=colW,0,0,0,1,41.12,1,1,0,0
6=colH,0,0,0,1,38.72,1,1,0,0
7=colL,0,0,0,1,40.32,1,1,0,0
8=colOFFSET,0,0,0,1,361,1,0,0
9=colROT,0,0,0,1,105.6,1,1,0,0
10=colFLIP,0,0,0,1,197.8,1,1,0,0
11=colPOSX,0,0,0,1,43.216477,1,1,0,0
12=colPOSY,0,0,0,1,43.216477,1,1,0,0
13=colMATERIAL,0,0,1,1,20,1,1,0,0
14=colGROUP,0,1,0,1,65.6,1,1,0,0
15=colSTOREY,0,1,0,1,471.6,1,1,0,0
;[DG_PartInRawPartList_SUPERVISOR]
;0=colPDN,0,0,0,1,33.68,1,1,0
;1=colCALC,0,0,0,0,22.05,1,1,0
;2=colNAM,0,0,1,1,65,1,1,0
;3=colW,0,0,0,1,52.2,1,1,0
;4=colH,0,0,0,1,52.2,1,1,0
;5=colL,0,0,0,1,49,1,1,0
;6=colROTATED,0,0,0,1,49,1,1,0
;7=colINVERTED,0,0,0,1,49,1,1,0
;8=colPOSX,0,0,0,1,49,1,1,0
;9=colOFFSET,0,0,0,1,361,1,1,0
;10=colMATERIAL,0,0,1,1,43.216477,4,1,0
[DG_FeatureInPartInRawPartList_SUPERVISOR]
0=colREDO,0,0,0,0,28.8,1,1,0,0
1=colCALC,0,0,0,0,28.8,1,1,0,0
2=colDESC,0,0,0,1,0.606414,4,1,0
[DG_ParameterList_P]
0=colNAME,0,0,0,1,48,1,1,0,0
1=colDESC,0,0,0,1,607.2,1,1,0,0
2=colVALUE,0,0,0,0,70.6,1,1,0,0
3=colMIN,0,0,0,1,69.8,1,1,0,0
4=colMAX,0,0,0,1,1,4,1,0,0
[DG_ParameterList_Q]
0=colCUSTOM,0,0,0,0,52,1,1,0,0
1=colNAME,0,0,0,1,46.4,1,1,0,0
2=colDESC,0,0,0,1,572,1,1,0,0
3=colVALUE,0,0,0,0,61.8,1,1,0,0
4=colMIN,0,0,0,1,63.4,1,1,0,0
5=colMAX,0,0,0,1,1,4,1,0,0
[DG_DuploParameterList_Q]
0=colNAME,0,0,0,1,100,1,1,0,0
1=colDESC,0,0,0,1,200,1,1,0,0
2=colVALUE,0,0,0,0,100,1,1,0,0
3=colMIN,0,0,0,1,100,1,1,0,0
4=colMAX,0,0,0,1,20,1,1,0,0
[DG_SParamList_BEAM]
0=colACTIVE,0,0,0,0,20,1,1,0,0
1=colSECTXMAT,0,0,0,0,124.32,1,1,0,0
2=colL,0,0,0,0,41.12,1,1,0,0
3=colQTY,0,0,0,0,1,4,1,0,0
[DG_SParamList_WALL]
0=colACTIVE,0,0,0,0,20,1,1,0,0
1=colSECTXMAT,0,0,1,0,124.32,1,1,0,1
2=colW,0,0,1,0,40.32,1,1,0,0
3=colL,0,0,1,0,40.32,1,1,0,0
4=colQTY,0,0,1,0,1,4,1,0,0
[DG_SectXMatList_BEAM]
0=colSECTXMAT,1,1,1,0,149.12,1,1,0
1=colALIAS,0,1,1,0,67.52,1,1,0
2=colL,0,1,1,0,67.52,1,1,0
3=colMATERIAL,0,1,1,0,134.72,1,1,0
4=colQTY,0,1,1,0,70.32,4,1,0
[DG_SectXMatList_WALL]
0=colSECTXMAT,1,1,1,0,128.896,1,1,0
1=colALIAS,0,1,0,0,61.92,1,1,0
2=colW,0,1,1,0,67.84,1,1,0
3=colL,0,1,1,0,65.92,1,1,0
4=colMATERIAL,0,1,0,0,102.72,1,1,0
5=colQTY,0,1,1,0,90.32,4,1,0
[DG_VariablesList]
0=colNAME,0,0,0,0,146.52,1,1,0
1=colVARPATH,0,0,0,0,278.4,1,1,0
2=colTYPE,0,0,0,0,30,4,1,0
[DG_MDICommands]
0=colCOMMAND,0,0,0,0,146.52,1,1,0
1=colDESCRIPTION,0,0,0,0,278.4,4,1,0
[DG_UpdateBTLPartList]
0=colPDN,1,1,0,0,60.45,1,1,1,0
1=colNAM,1,1,0,0,249.25,1,1,1,0
2=colINSERT,1,1,0,1,81.87,1,1,1,0
;[DG_ParameterList]
;0=colCUSTOM,0,0,0,0,29.6,1,1,0
;1=colNAME,0,0,0,1,211.2,1,1,0
;2=colDESC,0,0,0,1,0.606414,4,1,0
;3=colVALUE,0,0,0,0,52.2,1,1,0
;4=colMIN,0,0,0,1,52.2,1,1,0
;5=colMAX,0,0,0,1,49,4,1,0
;[DG_QParamList]
;0=colNAME,0,0,0,1,33.68,1,1,0
;1=colDESC,0,0,0,0,22.05,1,1,0
;2=colDEFAULT,0,0,0,0,52.2,1,1,0
;3=colMIN,0,0,0,1,52.2,1,1,0
;4=colMAX,0,0,0,1,49,4,1,0
@@ -0,0 +1,43 @@
; Index, DimensionType (0 = COLUMN, 1 = ROW), GridLength, GridUnitType (1 = Pixel, 2 = Star)
[Project_View]
0=0,0,513.655633,2
1=2,0,1465.744367,2
2=1,1,702.223627,2
3=3,1,310.816373,2
[Project_Optimizer]
0=0,0,388.767822,2
1=2,0,1450.232178,2
2=1,1,447.275899,2
3=3,1,493.764101,2
[LeftPanel_View]
0=1,1,323.337225,2
1=3,1,304.822775,2
[LeftPanel_Optimizer]
0=1,1,371.895729,2
1=3,1,256.264271,2
[TopPanel_Optimizer]
0=0,0,761.9,2
1=2,0,325.966667,2
2=0,1,267.710343,2
3=2,1,227.053758,2
4=0,1,354.635738,2
5=2,1,94.635738,2
[LeftPanel_Supervisor]
0=1,1,168,2
1=3,1,200.24,2
[Project_Supervisor]
0=0,0,627.390489,2
1=2,0,517.609511,2
;[Project_View]
;0=0,0,339,1
;1=2,0,1,2
;2=1,1,342.52,2
;3=3,1,341.52,2
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,112 @@
; Commento per evitare BOM con UTF-8
[General]
Debug=5
Licence=Key-000335-EgtBeamWall-Carlo Baronchelli_OK.lic
UserLevel=1
MaxInstances=1
Instances=0
MaxCamInstances=4
CommandLog=1
Messages=Italiano
WinPlace=1,-1791,220,1986,1152
LastImpDir=E:\EGALWARE\ProgramData\BeamWall
Support=support@egaltech.com
LastProj=C:\ProgramData\Egaltech\EgtBeamWall\Projs\0001\0001.nge
Warehouse=2
UserName=Utente Windows
ViewOptimInstances=1
[Languages]
Count=2
Language1=Italiano,EgalTechIta.txt
Language2=English,EgalTechEng.txt
Language3=Francais,EgalTechFra.txt
Language4=Deutsch,EgalTechDeu.txt
Language5=Espagnol,EgalTechEsp.txt
Language6=Portugues,EgalTechPor.txt
[Lua]
LibsDir=C:\ProgramData\EgalTech\EgtBeamWall\LuaLibs
BaseLib=EgtBase
[GeomDB]
DefaultFont=ModernPropS.Nfe
NfeFontDir=C:\ProgramData\EgalTech\EgtBeamWall\Fonts
DefaultColor=128,0,0
SaveType=2 ; 0=testo, 1=binario, 2=testo compresso
SurfTmToler=0.05
[OpenGL]
DoubleBuffer=1
ColorBits=32
DepthBits=24
Driver=3 ; 1=software, 2=OldWay, 3=NewWay
[Scene]
BackTop=176,208,210
BackBottom=145,177,196
ShowGFrame=1
Mark=255,255,0
SelSurf=255,64,64
ShowMode=2
CurveDir=0
ShowTriaAdv=1
ShowZmap=9 ; +1=surf, +2=lines, +4=normals, +8=più colori
TextureMaxLinPixels=2048
ZoomWin=0,255,255,255,30
DistLine=255,0,0
MmUnits=1
LineWidth=1
ShowBuilding=0
[Grid]
DrawShowGrid=1
MachiningShowGrid=0
ShowFrame=1
SnapStep=15
SnapStepInch=25.4
MinLineSStep=1
MajLineSStep=10
ExtSStep=100
MinLnColor=153,153,153
MajLnColor=153,153,153
[Import]
BtlFlag=8 ; +1=FlatPos +2=VertPos +4=SpecialTrim +8=TS3Pos +16=Sort +32=UserAttr +64=OutlineFlatPos
WallBtlFlag=64
[Beam]
CalcPath=C:\Program Files (x86)\Egaltech\EgtCAM5\EgtCAM5R32.exe
BaseDir=C:\ProgramData\Egaltech\EgtCAM5\Beam
BweExec=BatchProcessNew.lua
[Wall]
CalcPath=C:\Program Files (x86)\Egaltech\EgtCAM5\EgtCAM5R32.exe
;BaseDir=C:\ProgramData\Egaltech\EgtCAM5\Wall
BaseDir=C:\ProgramData\Egaltech\Progetto Restyling Wall\Wall
BweExec=BatchProcessNew.lua
[Nest]
NestExec=NestProcess.lua
FlipRot=NestFlipAndRotate.lua
NestDir=C:\ProgramData\Egaltech\EgtCAM5\Wall
LDIntersOther=0
MinScore=0
[Mach]
MachinesDir=C:\EgtData\Machines
ToolMakersDir=C:\ProgramData\Egaltech\EgtCAM5\ToolMakers
CurrMach=Essetre-90480027
SupervisorMach=
[DimensionStyle]
TextHeight=30
[MruProjFiles]
File1=C:\ProgramData\Egaltech\EgtBeamWall\Projs\0001\0001.nge
File2=
File3=
File4=
File5=
File6=
File7=
File8=
@@ -0,0 +1,13 @@
; Commento per evitare BOM con UTF-8
[Licence]
Customer=Key-000335-EgtBeamWall-Carlo Baronchelli
LockId=EGTECH-000335-oOoCcE
Product=5327
Ver=2404
Lev=1
ExpDays=19388
Opt1=175
Opt2=27
OptExpDays=19388
Key=+lTlApqOYxxY9skEbspi7pcOGOMzlIvMXW/WIb34Y3XJpjnK
@@ -0,0 +1,13 @@
; Commento per evitare BOM con UTF-8
[Licence]
Customer=Key-000335-EgtBeamWall-Carlo Baronchelli
LockId=EGTECH-000335-oOoCcE
Product=5327
Ver=2401
Lev=1
ExpDays=19388
Opt1=687
Opt2=11
OptExpDays=19388
Key=tTLnO5c9Ky4IitnioXwE8LVP7nsnpyj5AFMeyG3chcCJOqpZ
+3
View File
@@ -0,0 +1,3 @@
; Commento per evitare BOM con UTF-8
[Data]
DataRoot=C:\ProgramData\Egaltech\EgtCAM5
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,313 @@
-- EgtBBox3d.lua by EgalTech s.r.l. 2021/12/26
-- Tavola per definizione modulo (serve ma non usata)
local EgtBBox3d = {}
EgtOutLog( 'EgtBBox3d started', 1)
-- Include
require( 'EgtPoint3d')
--EnableDebug( false)
-- Definizione classe BBox3d
BBox3d = {{},{}}
BBox3d.__index = BBox3d
-- funzione di utilita' per identificazione tipo
function isBBox3d( a)
return ( getmetatable( a) == BBox3d)
end
local function New( a, b)
local b3d = setmetatable( {{GEO.INFINITO,GEO.INFINITO,GEO.INFINITO},{-GEO.INFINITO,-GEO.INFINITO,-GEO.INFINITO}}, BBox3d)
if not a then
b3d[1] = Point3d( GEO.INFINITO, GEO.INFINITO, GEO.INFINITO)
b3d[2] = Point3d( -GEO.INFINITO, -GEO.INFINITO, -GEO.INFINITO)
elseif isBBox3d( a) then
b3d[1] = Point3d( a[1])
b3d[2] = Point3d( a[2])
elseif isBBox3d( a) and isBBox3d( b) then
b3d[1] = Point3d( a[1])
b3d[2] = Point3d( a[2])
BBox3d.AddPoint( b3d, b[1])
BBox3d.AddPoint( b3d, b[2])
elseif type(a) == 'table' and #a >= 2 and
type(a[1]) == 'table' and #a[1] >= 3 and
type(a[2]) == 'table' and #a[2] >= 3 then
b3d[1] = Point3d( GEO.INFINITO, GEO.INFINITO, GEO.INFINITO)
b3d[2] = Point3d( -GEO.INFINITO, -GEO.INFINITO, -GEO.INFINITO)
if a[1][1] < ( a[2][1] + GEO.EPS_SMALL) and
a[1][2] < ( a[2][2] + GEO.EPS_SMALL) and
a[1][3] < ( a[2][3] + GEO.EPS_SMALL) then
BBox3d.AddPoint( b3d, a[1])
BBox3d.AddPoint( b3d, a[2])
end
elseif isPoint3d( a) and isPoint3d( b) then
b3d[1] = Point3d(GEO.INFINITO,GEO.INFINITO,GEO.INFINITO)
b3d[2] = Point3d(-GEO.INFINITO,-GEO.INFINITO,-GEO.INFINITO)
BBox3d.AddPoint( b3d, a)
BBox3d.AddPoint( b3d, b)
elseif isPoint3d( a) then
b3d[1] = Point3d(GEO.INFINITO,GEO.INFINITO,GEO.INFINITO)
b3d[2] = Point3d(-GEO.INFINITO,-GEO.INFINITO,-GEO.INFINITO)
BBox3d.AddPoint( b3d, a)
else
error( 'A parameter is wrong', 2)
end
return b3d
end
setmetatable( BBox3d, { __call = function( _, ...) return New( ...) end })
-- verifico se vuoto
function BBox3d:isEmpty()
-- il minimo non è minore del massimo
return not ( self[1][1] < ( self[2][1] + GEO.EPS_SMALL) and
self[1][2] < ( self[2][2] + GEO.EPS_SMALL) and
self[1][3] < ( self[2][3] + GEO.EPS_SMALL) )
end
-- somma di due box (+)
function BBox3d.__add( a, b)
if isBBox3d( a) and isBBox3d( b) then
return New( a, b)
else
error( 'A parameter is not a BBox3d', 2)
end
end
-- aggiungo box o punto
function BBox3d:Add( a)
if isBBox3d( a) then
if not a:isEmpty() then
self:AddPoint( a[1])
self:AddPoint( a[2])
end
else
self:AddPoint( a)
end
end
-- aggiungo un punto (solo per uso interno)
function BBox3d:AddPoint( ptP)
if ptP[1] < self[1][1] then
self[1][1] = ptP[1]
end
if ptP[2] < self[1][2] then
self[1][2] = ptP[2]
end
if ptP[3] < self[1][3] then
self[1][3] = ptP[3]
end
if ptP[1] > self[2][1] then
self[2][1] = ptP[1]
end
if ptP[2] > self[2][2] then
self[2][2] = ptP[2]
end
if ptP[3] > self[2][3] then
self[2][3] = ptP[3]
end
return true
end
-- espansione isotropa
function BBox3d:expand( dDelta)
if not isBBox3d( self) then
return false
end
if BBox3d.isEmpty(self) then
return true
end
self[1][1] = self[1][1] - dDelta
self[1][2] = self[1][2] - dDelta
self[1][3] = self[1][3] - dDelta
self[2][1] = self[2][1] + dDelta
self[2][2] = self[2][2] + dDelta
self[2][3] = self[2][3] + dDelta
end
-- traslazione
function BBox3d:move( m)
if not isBBox3d( self) then
return false
end
if BBox3d.isEmpty(self) then
return true
end
if isVector3d( m) or ( type( m) == 'table' and #m >= 3) then
self[1][1] = self[1][1] + m[1]
self[1][2] = self[1][2] + m[2]
self[1][3] = self[1][3] + m[3]
self[2][1] = self[2][1] + m[1]
self[2][2] = self[2][2] + m[2]
self[2][3] = self[2][3] + m[3]
return true
else
return false
end
end
function BBox3d:rotate( ptAx, vtAx, dAngDeg)
if not isBBox3d( self) or not isPoint3d( ptAx) or not isVector3d( vtAx) or type( dAngDeg) ~= 'number' then
return false
end
if BBox3d.isEmpty(self) then
return true
end
local bOk, b3New = EgtBBoxRotate( self, ptAx, vtAx, dAngDeg)
if bOk then
self[1] = Point3d( b3New[1])
self[2] = Point3d( b3New[2])
end
return bOk
end
-- trasformazione di riferimento verso globale
function BBox3d:toGlob( fTool)
if not isBBox3d( self) or not isFrame3d( fTool) then
return false
end
if BBox3d.isEmpty(self) then
return true
end
local bOk, b3New = EgtBBoxToGlob( self, fTool)
if bOk then
self[1] = Point3d( b3New[1])
self[2] = Point3d( b3New[2])
end
return bOk
end
-- trasformazione di riferimento verso locale
function BBox3d:toLoc( fTool)
if not isBBox3d( self) or not isFrame3d( fTool) then
return false
end
if BBox3d.isEmpty(self) then
return true
end
local bOk, b3New = EgtBBoxToLoc( self, fTool)
if bOk then
self[1] = Point3d( b3New[1])
self[2] = Point3d( b3New[2])
end
return bOk
end
-- trasformazione di riferimento da locale a locale
function BBox3d:locToLoc( fOri, fDest)
if not isBBox3d( self) or not isFrame3d( fOri) or not isFrame3d( fDest) then
return false
end
if BBox3d.isEmpty(self) then
return true
end
local bOk, b3New = EgtBBoxLocToLoc( self, fOri, fDest)
if bOk then
self[1] = Point3d( b3New[1])
self[2] = Point3d( b3New[2])
end
return bOk
end
-- restituzione componenti
function BBox3d:getMin()
if BBox3d.isEmpty(self) then
return nil
end
return Point3d( self[1])
end
function BBox3d:getMax()
if BBox3d.isEmpty(self) then
return nil
end
return Point3d( self[2])
end
function BBox3d:getDimX()
if BBox3d.isEmpty(self) then
return nil
end
return ( self[2][1] - self[1][1])
end
function BBox3d:getDimY()
if BBox3d.isEmpty(self) then
return nil
end
return ( self[2][2] - self[1][2])
end
function BBox3d:getDimZ()
if BBox3d.isEmpty(self) then
return nil
end
return ( self[2][3] - self[1][3])
end
function BBox3d:getCenter()
if BBox3d.isEmpty(self) then
return nil
end
return 0.5 * ( Point3d( self[1]) + Point3d( self[2]))
end
function BBox3d:getRadius()
if BBox3d.isEmpty(self) then
return nil
end
return 0.5 * dist( Point3d( self[1]), Point3d( self[2]))
end
-- conversione in stringa (tostring)
function BBox3d:__tostring()
if BBox3d.isEmpty(self) then
return '(empty)'
end
return '('.. tostring(self[1])..','..tostring(self[2])..')'
end
-- verifica che il box includa il punto in XY
function EnclosesPointXY( b3Box, ptP)
if b3Box[2][1] < ptP[1] - GEO.EPS_SMALL or b3Box[1][1] > ptP[1] + GEO.EPS_SMALL then
return false
end
if b3Box[2][2] < ptP[2] - GEO.EPS_SMALL or b3Box[1][2] > ptP[2] + GEO.EPS_SMALL then
return false
end
return true
end
-- verifica che il primo box includa il secondo in XY
function EnclosesXY( b3First, b3Second)
if not isBBox3d( b3First) or not isBBox3d( b3Second) then
return false
end
if BBox3d.isEmpty( b3First) or BBox3d.isEmpty( b3Second) then
return false
end
return EnclosesPointXY( b3First, b3Second:getMin()) and EnclosesPointXY( b3First, b3Second:getMax())
end
-- verifica di interferenza tra due box in XY
function OverlapsXY( b3First, b3Second)
if not isBBox3d( b3First) or not isBBox3d( b3Second) then
return false
end
if BBox3d.isEmpty( b3First) or BBox3d.isEmpty( b3Second) then
return false
end
if b3First[2][1] < b3Second[1][1] - GEO.EPS_SMALL or b3First[1][1] > b3Second[2][1] + GEO.EPS_SMALL then
return false
end
if b3First[2][2] < b3Second[1][2] - GEO.EPS_SMALL or b3First[1][2] > b3Second[2][2] + GEO.EPS_SMALL then
return false
end
return true
end
return EgtBBox3d
+647
View File
@@ -0,0 +1,647 @@
-- EgtLib.lua libreria di base EgalTech per Lua 2022/04/12
-- 2019/12/04 EgtTestBreak interruzione se valore 1.
-- 2020/06/04 Aggiunta funzione EgtCurveIsACircle.
-- 2020/06/16 Aggiunta funzione EgtSurfTmGetFacetBBoxRef.
-- 2021/11/27 Aggiunta funzione EgtClamp.
-- 2022/04/12 Aggiunta funzione EgtGetValInNotes.
-- Tavola per definizione modulo (serve ma non usata)
local EgtBase = {}
EgtOutLog( 'EgtBase started', 1)
-- Funzioni del package matematico rese globali e con angoli in gradi
abs = math.abs
fmod = math.fmod
floor = math.floor
ceil = math.ceil
min = math.min
max = math.max
huge = math.huge
modf = math.modf
sqrt = math.sqrt
pow = function( x, y) return x ^ y end
exp = math.exp
log = math.log
log10 = function( x) return math.log( x, 10) end
ldexp = function( x, exp) return x * 2.0 ^ exp end
deg = math.deg
rad = math.rad
pi = math.pi
sin = function( x) return math.sin( math.rad( x)) end
cos = function( x) return math.cos( math.rad( x)) end
tan = function( x) return math.tan( math.rad( x)) end
asin = function( x) return math.deg( math.asin( x)) end
acos = function( x) return math.deg( math.acos( x)) end
atan = function( y, x) return math.deg( math.atan( y, x)) end
atan2 = function( y, x) return math.deg( math.atan( y, x)) end
random = math.random
randomseed = math.randomseed
tointeger = math.tointeger
----------------------------------------------------------------------------
function EgtIf( bCond, Val1, Val2)
if bCond then
return Val1
else
return Val2
end
end
----------------------------------------------------------------------------
function EgtClamp( Val, Min, Max)
if Min > Max then
Min, Max = Max, Min
end
if Val < Min then
return Min
elseif Val > Max then
return Max
else
return Val
end
end
----------------------------------------------------------------------------
-- Funzione per protezione variabili e funzioni globali
function EgtProtectGlobal()
local newgt = {}
setmetatable( newgt, {__index = _G,
__newindex = function( t, k, v)
local k3 = string.sub( k, 1, 3)
if k3 == 'Egt' or k3 == 'Emt' or
k3 == 'GEO' or k3 == 'GDB' or k3 == 'SCE' or k3 == 'MCH' then
error( "attempting to change global "..tostring( k)..' to '..tostring( v), 2)
else
rawset( t, k, v)
end
end
})
return newgt
end
-- Funzione per lancio, se richiesta, predisposizione debug
function EgtEnableDebug( bOn)
if not bOn then
EgtOutLog( 'Release Mode', 1)
return true
elseif EgtIs64bit() then
-- non funziona a 64 bit
EgtOutLog( 'Skipped Debug Activation (64bit)')
return false
else
-- carico il modulo opportuno
EgtOutLog( 'Debug Mode (32bit)', 1)
return require( 'mobdebug').start()
end
end
-- Funzione per reset librerie
function EgtResetLibs()
package.loaded.EgtTest = nil
package.loaded.EgtBase = nil
package.loaded.EgtConst = nil
package.loaded.EgtVector3d = nil
package.loaded.EgtPoint3d = nil
package.loaded.EgtFrame3d = nil
package.loaded.EgtBBox3d = nil
package.loaded.EgtColor3d = nil
package.loaded.Dimension = nil
package.loaded.EgtLinearDimension = nil
package.loaded.EmtGenerator = nil
end
----------------------------------------------------------------------------
-- Funzione per OutLog di tutte le variabili globali
function EgtOutLogAllGlobVars()
local a = {}
for k,v in pairs( _G) do
a[#a+1] = k .. " => ".. tostring( v)
end
table.sort( a)
EgtOutLog( 'Global Variables (#' .. #a .. ') :')
for _,v in ipairs( a) do
EgtOutLog( v)
end
end
----------------------------------------------------------------------------
-- Funzione per avere direttorio del file che lancia la funzione
function EgtGetSourceDir( nUp)
local nSou = 2
if nUp then nSou = nSou + nUp end
local info = debug.getinfo( nSou, 'S')
local dir = info.source:match("^@?(.-)([^\\/]-%.?([^%.\\/]*))$")
return dir
end
----------------------------------------------------------------------------
-- Funzione per avere direttorio e file che lancia la funzione
function EgtGetSourcePath( nUp)
local nSou = 2
if nUp then nSou = nSou + nUp end
local info = debug.getinfo( nSou, 'S')
local dir = string.gsub( info.source, '@', '')
return dir
end
-- Funzione per accodare path di ricerca librerie lua
function EgtAddToPackagePath( path)
if not package.path:find( path, 1, true) then
if package.path:sub( -1) == ';' then
package.path = package.path .. path .. ';'
else
package.path = package.path .. ';' .. path .. ';'
end
end
end
-- Funzione per rimuovere direttori macchine da path di ricerca librerie lua
function EgtRemoveBaseMachineDirFromPackagePath()
local vLibDir = EgtSplitString( _G.package.path, ';')
if not vLibDir or #vLibDir == 0 then return end
local sBaseMachDir = EgtSplitPath( EgtGetCurrMachineDir() or '')
if not sBaseMachDir or #sBaseMachDir == 0 then return end
package.path = ''
for i = 1, #vLibDir do
if #vLibDir[i] > 0 and not vLibDir[i]:find( sBaseMachDir, 1, true) then
package.path = package.path .. vLibDir[i] .. ';'
end
end
end
-- Funzione per dividere Path in Direttorio, NomeFile e Estensione
function EgtSplitPath( sPath)
local sDir, sFile = string.match(sPath, "(.-)([^\\/]*)$")
local sName, sExt
if sFile and string.find(sFile,'%.') then
sName, sExt = string.match(sFile,'(.*)([%.].-)$')
else
sName = sFile
sExt = ''
end
return sDir, sName, sExt
end
-- Funzione per cambiare estensione di una Path
function EgtChangePathExtension( sPath, sExt)
local sFileDir, sFileName, sFileExt = EgtSplitPath( sPath)
if string.sub( sExt, 1, 1) == '.' then
return sFileDir .. sFileName .. sExt
else
return sFileDir .. sFileName .. '.' .. sExt
end
end
----------------------------------------------------------------------------
-- Funzioni di trim di stringhe di caratteri
function EgtTrimRight( sStr)
if not sStr then return nil end
return sStr:match( "(.-)%s*$")
end
function EgtTrimLeft( sStr)
if not sStr then return nil end
return sStr:match( "^%s*(.*)")
end
function EgtTrim( sStr)
if not sStr then return nil end
return sStr:match( "^%s*(.-)%s*$")
end
----------------------------------------------------------------------------
-- Funzione per aggiungere/togliere coppie chiave/valore da una stringa di note
function EgtAdjustNotes( sNotes, sKey, Val)
local sNewNotes = ''
local vItem = EgtSplitString( sNotes, ';') or {}
for i = 1, #vItem do
local sItem = EgtTrim( vItem[i])
if sItem and #sItem > 0 and not sItem:find( sKey, 1, true) then
sNewNotes = sNewNotes .. sItem .. ';'
end
end
if Val and Val ~= '' then
sNewNotes = sNewNotes .. EgtSetVal( sKey, Val)
end
return sNewNotes
end
----------------------------------------------------------------------------
-- Funzione per recuperare un valore data la chiave da una stringa di note
function EgtGetValInNotes( sNotes, sKey, sType)
local vItem = EgtSplitString( sNotes, ';') or {}
for i = 1, #vItem do
local sItem = EgtTrim( vItem[i])
if sItem and #sItem > 0 and sItem:find( sKey..'=', 1, true) then
return EgtGetVal( sItem, sKey, sType)
end
end
return nil
end
----------------------------------------------------------------------------
-- Funzione per creare tabella da primo indice per numero indici consecutivi
function EgtTableFill( nStart, nCount)
if not nStart or nCount <= 0 then return nil end
local T = {}
for i = 0,nCount-1 do
table.insert( T, nStart+i)
end
return T
end
-- Funzione per aggiungere a tabella da primo indice per numero indici consecutivi
function EgtTableAdd( T, nStart, nCount)
if not nStart or nCount <= 0 then return T end
for i = 0,nCount-1 do
table.insert( T, nStart+i)
end
return T
end
-- Funzione per unire due tabelle
function EgtJoinTables( Ta, Tb)
for k, v in ipairs( Tb) do
table.insert( Ta, v)
end
return Ta
end
----------------------------------------------------------------------------
-- Funzione per aggiornare interfaccia e consentire interruzione esecuzione
function EgtTestBreak( nProc, nPause)
local nRet = EgtProcessEvents( nProc, nPause)
if nRet == 1 then
error( "User aborted", 2)
end
end
----------------------------------------------------------------------------
-- Richiamo librerie componenti
require( 'EgtConst')
require( 'EgtVector3d')
require( 'EgtPoint3d')
require( 'EgtFrame3d')
require( 'EgtBBox3d')
require( 'EgtColor3d')
-- Ridefinizione funzioni per ritornare Vector3d
local o_EgtGetGridVersZ = EgtGetGridVersZ
EgtGetGridVersZ = function(...)
local vtV = o_EgtGetGridVersZ(...)
if vtV then return Vector3d( vtV) end
end
local o_EgtSV = EgtSV
EgtSV = function(...)
local vtV = o_EgtSV(...)
if vtV then return Vector3d( vtV) end
end
local o_EgtEV = EgtEV
EgtEV = function(...)
local vtV = o_EgtEV(...)
if vtV then return Vector3d( vtV) end
end
local o_EgtMV = EgtMV
EgtMV = function(...)
local vtV = o_EgtMV(...)
if vtV then return Vector3d( vtV) end
end
local o_EgtUV = EgtUV
EgtUV = function(...)
local vtV = o_EgtUV(...)
if vtV then return Vector3d( vtV) end
end
local o_EgtET = EgtET
EgtET = function(...)
local vtV = o_EgtET(...)
if vtV then return Vector3d( vtV) end
end
local o_EgtCurveExtrusion = EgtCurveExtrusion
EgtCurveExtrusion = function(...)
local vtV = o_EgtCurveExtrusion(...)
if vtV then return Vector3d( vtV) end
end
local o_EgtArcNormVersor = EgtArcNormVersor
EgtArcNormVersor = function(...)
local vtV = o_EgtArcNormVersor(...)
if vtV then return Vector3d( vtV) end
end
local o_EgtSurfFrNormVersor = EgtSurfFrNormVersor
EgtSurfFrNormVersor = function(...)
local vtV = o_EgtSurfFrNormVersor(...)
if vtV then return Vector3d( vtV) end
end
local o_EgtSurfTmFacetNormVersor = EgtSurfTmFacetNormVersor
EgtSurfTmFacetNormVersor = function(...)
local vtV = o_EgtSurfTmFacetNormVersor(...)
if vtV then return Vector3d( vtV) end
end
local o_EgtTextNormVersor = EgtTextNormVersor
EgtTextNormVersor = function(...)
local vtV = o_EgtTextNormVersor(...)
if vtV then return Vector3d( vtV) end
end
local o_EgtGetCalcToolDirFromAngles = EgtGetCalcToolDirFromAngles
EgtGetCalcToolDirFromAngles = function(...)
local vtV = o_EgtGetCalcToolDirFromAngles(...)
if vtV then return Vector3d( vtV) end
end
local o_EgtGetCalcAuxDirFromAngles = EgtGetCalcAuxDirFromAngles
EgtGetCalcAuxDirFromAngles = function(...)
local vtV = o_EgtGetCalcAuxDirFromAngles(...)
if vtV then return Vector3d( vtV) end
end
-- Ridefinizione funzioni per ritornare Vector3d e altri parametri
local o_EgtCurveIsFlat = EgtCurveIsFlat
EgtCurveIsFlat = function(...)
local bFlat, vtN, dDist = o_EgtCurveIsFlat(...)
if vtN then return bFlat, Vector3d( vtN), dDist end
end
local o_EgtCurveArea = EgtCurveArea
EgtCurveArea = function(...)
local vtN, dDist, dArea = o_EgtCurveArea(...)
if vtN then return Vector3d( vtN), dDist, dArea end
end
-- Ridefinizione funzioni per ritornare Point3d
local o_EgtSP = EgtSP
EgtSP = function(...)
local ptP = o_EgtSP(...)
if ptP then return Point3d( ptP) end
end
local o_EgtEP = EgtEP
EgtEP = function(...)
local ptP = o_EgtEP(...)
if ptP then return Point3d( ptP) end
end
local o_EgtMP = EgtMP
EgtMP = function(...)
local ptP = o_EgtMP(...)
if ptP then return Point3d( ptP) end
end
local o_EgtCP = EgtCP
EgtCP = function(...)
local ptP = o_EgtCP(...)
if ptP then return Point3d( ptP) end
end
local o_EgtGP = EgtGP
EgtGP = function(...)
local ptP = o_EgtGP(...)
if ptP then return Point3d( ptP) end
end
local o_EgtUP = EgtUP
EgtUP = function(...)
local ptP = o_EgtUP(...)
if ptP then return Point3d( ptP) end
end
local o_EgtNP = EgtNP
EgtNP = function(...)
local ptP = o_EgtNP(...)
if ptP then return Point3d( ptP) end
end
local o_EgtIP = EgtIP
EgtIP = function(...)
local ptP = o_EgtIP(...)
if ptP then return Point3d( ptP) end
end
local o_EgtCurveCompoCenter = EgtCurveCompoCenter
EgtCurveCompoCenter = function(...)
local ptP = o_EgtCurveCompoCenter(...)
if ptP then return Point3d( ptP) end
end
local o_EgtGetTableRef = EgtGetTableRef
EgtGetTableRef = function(...)
local ptP = o_EgtGetTableRef(...)
if ptP then return Point3d( ptP) end
end
local o_EgtGetCalcTipFromPositions = EgtGetCalcTipFromPositions
EgtGetCalcTipFromPositions = function(...)
local ptP = o_EgtGetCalcTipFromPositions(...)
if ptP then return Point3d( ptP) end
end
local o_EgtGetRawPartCenter = EgtGetRawPartCenter
EgtGetRawPartCenter = function(...)
local ptP = o_EgtGetRawPartCenter(...)
if ptP then return Point3d( ptP) end
end
local o_EgtGetMachiningStartPoint = EgtGetMachiningStartPoint
EgtGetMachiningStartPoint = function(...)
local ptP = o_EgtGetMachiningStartPoint(...)
if ptP then return Point3d( ptP) end
end
local o_EgtGetMachiningEndPoint = EgtGetMachiningEndPoint
EgtGetMachiningEndPoint = function(...)
local ptP = o_EgtGetMachiningEndPoint(...)
if ptP then return Point3d( ptP) end
end
-- Ridefinizione funzioni per ritornare Point3d e altri parametri
local o_EgtSurfTmFacetsContact = EgtSurfTmFacetsContact
EgtSurfTmFacetsContact = function(...)
local bAdj, ptP1, ptP2, dAng = o_EgtSurfTmFacetsContact(...)
if bAdj and ptP1 and ptP2 and dAng then
return bAdj, Point3d( ptP1), Point3d( ptP2), dAng
else
return bAdj
end
end
local o_EgtSurfTmFacetOppositeSide = EgtSurfTmFacetOppositeSide
EgtSurfTmFacetOppositeSide = function(...)
local ptP1, ptPm, ptP2, vtV1, vtV2, dL, dW = o_EgtSurfTmFacetOppositeSide(...)
if ptP1 and ptPm and ptP2 and vtV1 and vtV2 then
return Point3d( ptP1), Point3d( ptPm), Point3d( ptP2), Vector3d( vtV1), Vector3d( vtV2), dL, dW
end
end
local o_EgtPointCurveDist = EgtPointCurveDist
EgtPointCurveDist = function(...)
local dDist, ptNear, dU = o_EgtPointCurveDist(...)
if dDist then return dDist, Point3d( ptNear), dU end
end
local o_EgtGetLastSelInfo = EgtGetLastSelInfo
EgtGetLastSelInfo = function(...)
local nId, nSub, ptSel = o_EgtGetLastSelInfo(...)
if nId then return nId, nSub, Point3d( ptSel) end
end
local o_EgtGetPrevSelInfo = EgtGetPrevSelInfo
EgtGetPrevSelInfo = function(...)
local nId, nSub, ptSel = o_EgtGetPrevSelInfo(...)
if nId then return nId, nSub, Point3d( ptSel) end
end
local o_EgtSurfBezierGetPoint = EgtSurfBezierGetPoint
EgtSurfBezierGetPoint = function(...)
local ptP = o_EgtSurfBezierGetPoint(...)
if ptP then
return Point3d( ptP)
end
end
local o_EgtSurfBezierGetPointD1 = EgtSurfBezierGetPointD1
EgtSurfBezierGetPointD1 = function(...)
local ptP, vtDerU, vtDerV = o_EgtSurfBezierGetPointD1(...)
if ptP and vtDerU and vtDerV then
return Point3d( ptP), Vector3d( vtDerU), Vector3d( vtDerV)
end
end
local o_EgtSurfBezierGetPointNrmD1 = EgtSurfBezierGetPointNrmD1
EgtSurfBezierGetPointNrmD1 = function(...)
local ptP, vtN, vtDerU, vtDerV = o_EgtSurfBezierGetPointNrmD1(...)
if ptP and vtDerU and vtDerV then
return Point3d( ptP), Vector3d( vtN), Vector3d( vtDerU), Vector3d( vtDerV)
end
end
-- Ridefinizione funzioni per ritornare Point3d e Vector3d
local o_EgtSurfTmFacetNearestEndPoint = EgtSurfTmFacetNearestEndPoint
EgtSurfTmFacetNearestEndPoint = function(...)
local ptP, vtN = o_EgtSurfTmFacetNearestEndPoint(...)
if ptP and vtN then return Point3d( ptP), Vector3d( vtN) end
end
local o_EgtSurfTmFacetNearestMidPoint = EgtSurfTmFacetNearestMidPoint
EgtSurfTmFacetNearestMidPoint = function(...)
local ptP, vtN = o_EgtSurfTmFacetNearestMidPoint(...)
if ptP and vtN then return Point3d( ptP), Vector3d( vtN) end
end
local o_EgtSurfTmFacetCenter = EgtSurfTmFacetCenter
EgtSurfTmFacetCenter = function(...)
local ptP, vtN = o_EgtSurfTmFacetCenter(...)
if ptP and vtN then return Point3d( ptP), Vector3d( vtN) end
end
local o_EgtCurveIsACircle = EgtCurveIsACircle
EgtCurveIsACircle = function(...)
local bCirc, ptC, vtN, dRad, bCCW = o_EgtCurveIsACircle(...)
if bCirc then return bCirc, Point3d( ptC), Vector3d( vtN), dRad, bCCW end
end
-- Ridefinizione funzioni per ritornare Frame3d
local o_EgtGetGridFrame = EgtGetGridFrame
EgtGetGridFrame = function()
local frRef = o_EgtGetGridFrame()
if frRef then return Frame3d( frRef) end
end
local o_EgtGetGlobFrame = EgtGetGlobFrame
EgtGetGlobFrame = function(...)
local frRef = o_EgtGetGlobFrame(...)
if frRef then return Frame3d( frRef) end
end
local o_EgtGetGroupGlobFrame = EgtGetGroupGlobFrame
EgtGetGroupGlobFrame = function(...)
local frRef = o_EgtGetGroupGlobFrame(...)
if frRef then return Frame3d( frRef) end
end
local o_EgtFR = EgtFR
EgtFR = function(...)
local frRef = o_EgtFR(...)
if frRef then return Frame3d( frRef) end
end
local o_EgtGetTextureFrame = EgtGetTextureFrame
EgtGetTextureFrame = function(...)
local frRef = o_EgtGetTextureFrame(...)
if frRef then return Frame3d( frRef) end
end
-- Ridefinizione funzioni per ritornare Frame3d e altri parametri
local o_EgtCurveMinAreaRectangleXY = EgtCurveMinAreaRectangleXY
EgtCurveMinAreaRectangleXY = function(...)
local frRect, dDimX, dDimY = o_EgtCurveMinAreaRectangleXY(...)
if frRect then return Frame3d( frRect), dDimX, dDimY end
end
local o_EgtSurfTmFacetMinAreaRectangle = EgtSurfTmFacetMinAreaRectangle
EgtSurfTmFacetMinAreaRectangle = function(...)
local frRect, dDimX, dDimY = o_EgtSurfTmFacetMinAreaRectangle(...)
if frRect then return Frame3d( frRect), dDimX, dDimY end
end
-- Ridefinizione funzioni per ritornare BBox3d
local o_EgtGetBBox = EgtGetBBox
EgtGetBBox = function(...)
local b3Box = o_EgtGetBBox(...)
if b3Box then return BBox3d( b3Box) end
end
local o_EgtGetBBoxGlob = EgtGetBBoxGlob
EgtGetBBoxGlob = function(...)
local b3Box = o_EgtGetBBoxGlob(...)
if b3Box then return BBox3d( b3Box) end
end
local o_EgtGetBBoxRef = EgtGetBBoxRef
EgtGetBBoxRef = function(...)
local b3Box = o_EgtGetBBoxRef(...)
if b3Box then return BBox3d( b3Box) end
end
local o_EgtGetTableArea = EgtGetTableArea
EgtGetTableArea = function(...)
local b3Box = o_EgtGetTableArea(...)
if b3Box then return BBox3d( b3Box) end
end
local o_EgtGetRawPartBBox = EgtGetRawPartBBox
EgtGetRawPartBBox = function(...)
local b3Box = o_EgtGetRawPartBBox(...)
if b3Box then return BBox3d( b3Box) end
end
local o_EgtSurfTmGetFacetBBox = EgtSurfTmGetFacetBBox
EgtSurfTmGetFacetBBox = function(...)
local b3Box = o_EgtSurfTmGetFacetBBox(...)
if b3Box then return BBox3d( b3Box) end
end
local o_EgtSurfTmGetFacetBBoxGlob = EgtSurfTmGetFacetBBoxGlob
EgtSurfTmGetFacetBBoxGlob = function(...)
local b3Box = o_EgtSurfTmGetFacetBBoxGlob(...)
if b3Box then return BBox3d( b3Box) end
end
local o_EgtSurfTmGetFacetBBoxRef = EgtSurfTmGetFacetBBoxRef
EgtSurfTmGetFacetBBoxRef = function(...)
local b3Box = o_EgtSurfTmGetFacetBBoxRef(...)
if b3Box then return BBox3d( b3Box) end
end
local o_EgtVolZmapGetPartBBox = EgtVolZmapGetPartBBox
EgtVolZmapGetPartBBox = function(...)
local b3Box = o_EgtVolZmapGetPartBBox(...)
if b3Box then return BBox3d( b3Box) end
end
local o_EgtVolZmapGetPartBBoxGlob = EgtVolZmapGetPartBBoxGlob
EgtVolZmapGetPartBBoxGlob = function(...)
local b3Box = o_EgtVolZmapGetPartBBoxGlob(...)
if b3Box then return BBox3d( b3Box) end
end
-- Ridefinizione funzioni per ritornare Color3d
local o_EgtStdColor = EgtStdColor
EgtStdColor = function(...)
local c3Col = o_EgtStdColor(...)
if c3Col then return Color3d( c3Col) end
end
local o_EgtGetColor = EgtGetColor
EgtGetColor = function(...)
local c3Col = o_EgtGetColor(...)
if c3Col then return Color3d( c3Col) end
end
local o_EgtGetCalcColor = EgtGetCalcColor
EgtGetCalcColor = function(...)
local c3Col = o_EgtGetCalcColor(...)
if c3Col then return Color3d( c3Col) end
end
local o_EgtGetBackground = EgtGetBackground
EgtGetBackground = function(...)
local c3Top, c3Bot = o_EgtGetBackground(...)
if c3Top and c3Bot then return Color3d( c3Top), Color3d( c3Bot) end
end
-- Ridefinizione funzioni per tornare diversi tipi di oggetti
local o_EgtGetInfo = EgtGetInfo
EgtGetInfo = function( Id, Key, sType)
local Val = o_EgtGetInfo( Id, Key, sType)
if sType == 'v' or sType == 'V' then
if Val then return Vector3d( Val) end
elseif sType == 'p' or sType == 'P' then
if Val then return Point3d( Val) end
elseif sType == 'x' or sType == 'X' then
if Val then return BBox3d( Val) end
elseif sType == 'f' or sType == 'F' then
if Val then return Frame3d( Val) end
else
return Val
end
end
return EgtBase
@@ -0,0 +1,170 @@
-- EgtColor3d.lua by EgalTech s.r.l. 2019/03/31
-- Tavola per definizione modulo (serve ma non usata)
local EgtColor3d = {}
EgtOutLog( 'EgtColor3d started', 1)
-- Include
require( 'EgtConst')
--EnableDebug( false)
-- Definizione classe Color3d
Color3d = {}
Color3d.__index = Color3d
-- funzione di utilita' per identificazione tipo
function isColor3d( a)
return ( getmetatable( a) == Color3d)
end
local function New( r, g, b, a)
local col = setmetatable( {0,0,0,0}, Color3d)
local function Clip( val, min, max)
if val < min then
return min
elseif val > max then
return max
else
return val
end
end
if not r then
return nil
elseif isColor3d( r) then
col[1] = r[1]
col[2] = r[2]
col[3] = r[3]
if type( g) == 'number' then
col[4] = Clip( g, 0, 100)
else
col[4] = r[4]
end
elseif type( r) == 'table' and #r >= 3 then
col[1] = Clip( r[1], 0, 255)
col[2] = Clip( r[2], 0, 255)
col[3] = Clip( r[3], 0, 255)
if #r >= 4 then
col[4] = Clip( r[4], 0, 100)
else
col[4] = 100
end
elseif type( r) == 'number' and type( g) == 'number' and type( b) == 'number' then
col[1] = Clip( r, 0, 255)
col[2] = Clip( g, 0, 255)
col[3] = Clip( b, 0, 255)
if type( a) == 'number' then
col[4] = Clip( a, 0, 100)
else
col[4] = 100
end
elseif type( r) == 'string' then
local stdCol = EgtStdColor( r)
col[1] = stdCol[1]
col[2] = stdCol[2]
col[3] = stdCol[3]
col[4] = stdCol[4]
else
error( 'A parameter is wrong', 2)
end
return col
end
setmetatable( Color3d, { __call = function( _, ...) return New(...) end })
-- restituzione componenti
function Color3d:getRed()
return self[1]
end
function Color3d:getGreen()
return self[2]
end
function Color3d:getBlue()
return self[3]
end
function Color3d:getAlpha()
return self[4]
end
-- conversione in stringa (tostring)
function Color3d:__tostring()
return '('.. self[1]..','..self[2]..','..self[3]..','..self[4] ..')'
end
-- funzione di confronto
function AreSameColor( a, b, Tol)
if isColor3d( a) and isColor3d( b) then
if not Tol then
Tol = 0
end
return math.abs( a[1] - b[1]) < Tol + 0.1 and
math.abs( a[2] - b[2]) < Tol + 0.1 and
math.abs( a[3] - b[3]) < Tol + 0.1 and
math.abs( a[4] - b[4]) < Tol + 0.1
else
return false
end
end
-- Colori notevoli
function WHITE()
return Color3d( 'WHITE')
end
function LGRAY()
return Color3d( 'LGRAY')
end
function GRAY()
return Color3d( 'GRAY')
end
function BLACK()
return Color3d( 'BLACK')
end
function RED()
return Color3d( 'RED')
end
function MAROON()
return Color3d( 'MAROON')
end
function YELLOW()
return Color3d( 'YELLOW')
end
function OLIVE()
return Color3d( 'OLIVE')
end
function LIME()
return Color3d( 'LIME')
end
function GREEN()
return Color3d( 'GREEN')
end
function AQUA()
return Color3d( 'AQUA')
end
function TEAL()
return Color3d( 'TEAL')
end
function BLUE()
return Color3d( 'BLUE')
end
function NAVY()
return Color3d( 'NAVY')
end
function FUCHSIA()
return Color3d( 'FUCHSIA')
end
function PURPLE()
return Color3d( 'PURPLE')
end
function ORANGE()
return Color3d( 'ORANGE')
end
function BROWN()
return Color3d( 'BROWN')
end
return EgtColor3d
@@ -0,0 +1,975 @@
-- EgtConst.lua libreria di costanti EgalTech per Lua 2022/02/04
-- 2018/02/22 Sistemata package.cpath per lua 5.3 con "/bin/clibs53/?.dll;"
-- 2019/07/24 Portato GEO.EPS_ZERO a 1e-8 come nel programma.
-- 2020/01/15 Aggiunta costante GDB_TY.EXT_DIMENSION.
-- 2020/02/06 Aggiunte costanti GDB_CRC.
-- 2020/02/14 Aggiunta costante MCH_GP.MAXDEPTHSAFE.
-- 2020/02/21 Aggiunta costante MCH_TY.MILL_POLISHING.
-- 2020/03/26 Aggiunta costante GDB_TY.SRF_BEZ.
-- 2020/06/05 Aggiunte costanti MCH_MP.TABMIN e MCH_MP.TABMAX.
-- 2020/10/12 Aggiunte costanti EEX_FL.
-- 2021/02/14 Aggiunte costanti NST_CORNER.
-- 2021/05/21 Aggiunta costante MCH_SIM_COB.CONE (tronco di cono).
-- 2021/07/28 Aggiunte costanti MCH_MP.SIDEANGFEED e MCH_MP.STEPLAST.
-- 2021/09/24 Aggiunte costanti MCH_MILL_LI.TG_PERP e MCH_MILL_LO.PERP_TG.
-- 2022/02/04 Aggiunte costanti MCH_MP.EPICYCLESRAD e MCH_MP.EPICYCLESDIST.
-- Tavola per definizione modulo (serve ma non usata)
local EgtConst = {}
EgtOutLog( 'EgtConst started', 1)
-- Per eventuale debug
local ZBS = "c:/ZeroBraneStudio"
if not package.path:find(ZBS,1,true) then
package.path = ZBS .. "/lualibs/?/?.lua;" .. ZBS .. "/lualibs/?.lua;" .. package.path
package.cpath = ZBS .. "/bin/?.dll;" .. ZBS .. "/bin/clibs53/?.dll;" .. package.cpath
end
-- Funzione per rendere non modificabili le costanti
local protect = function(tbl)
return setmetatable({}, {
__index = tbl,
__newindex = function(t, key, value)
error("attempting to change constant " ..
tbl[1]..tostring(key) .. " to " .. tostring(value), 2)
end
})
end
-- Costanti geometriche
GEO = {
'GEO.',
EPS_SMALL = 1.0e-3,
EPS_ZERO = 1.0e-8,
INFINITO = 1.0e10,
EPS_ANG_SMALL = 1.0e-3,
ONE_MM = 1.0,
ONE_INCH = 25.4
}
GEO = protect( GEO)
-- Costanti per tipo di file Nge
GDB_NT = {
'GDB_NT.',
TXT = 0,
BIN = 1,
CMPTXT = 2
}
GDB_NT = protect( GDB_NT)
-- Costanti per identificativi speciali di GDB
GDB_ID = {
'GDB_ID.',
ROOT = 0, -- radice
NULL = -1, -- non valido
SEL = -2, -- selezione
GRID = -3, -- griglia
CP = -4, -- current part
CL = -5 -- current layer
}
GDB_ID = protect( GDB_ID)
-- Costanti per posizione di inserimento in GDB in copia/trasferisci
GDB_IN = {
'GDB_IN.',
FIRST_SON = 0,
LAST_SON = 1,
BEFORE = 2,
AFTER = 3
}
GDB_IN = protect( GDB_IN)
-- Costanti per riferimento in cui sono espressi i dati della funzione
GDB_RT = {
'GDB_RT.',
GLOB = 0, -- globale
GRID = -3, -- griglia
LOC = -6 -- locale
}
GDB_RT = protect( GDB_RT)
-- Costanti per tipo di punto
GDB_PT = {
'GDB_PT.',
STD = 0,
TG = 1,
PERP = 2,
MIND = 3
}
GDB_PT = protect( GDB_PT)
-- Costanti per famiglie di oggetti
GDB_FY = {
'GDB_FY.',
NONE = 0,
GEO_ZERODIM = 128,
GEO_CURVE = 256,
GEO_SURF = 512,
GEO_VOLUME = 1024,
GEO_EXTRA = 2048
}
GDB_FY = protect( GDB_FY)
-- Costanti per tipo di oggetti
GDB_TY = {
'GDB_TY.',
NONE = 0,
GROUP = 2,
GEO_VECTOR = 128,
GEO_POINT = 129,
GEO_FRAME = 130,
CRV_LINE = 256,
CRV_ARC = 257,
CRV_BEZ = 258,
CRV_COMPO = 259,
SRF_MESH = 512,
SRF_FRGN = 513,
SRF_BEZ = 514,
VOL_ZMAP = 1024,
EXT_TEXT = 2048,
EXT_DIMENSION = 2049
}
GDB_TY = protect( GDB_TY)
-- Costanti per livello oggetti
GDB_LV = {
'GDB_LV.',
USER = 1,
SYSTEM = 2,
TEMP = 3
}
GDB_LV = protect( GDB_LV)
-- Costanti per modo oggetti
GDB_MD = {
'GDB_MD.',
STD = 1,
LOCKED = 2,
HIDDEN = 3
}
GDB_MD = protect( GDB_MD)
-- Costanti per stato oggetti
GDB_ST = {
'GDB_ST.',
OFF = 0,
ON = 1,
SEL = 2
}
GDB_ST = protect( GDB_ST)
-- Costanti per flag calcolo BBox3d
GDB_BB = {
'GDB_BB.',
STANDARD = 0,
ONLY_VISIBLE = 1,
EXACT = 2,
IGNORE_TEXT = 4,
IGNORE_DIM = 8
}
GDB_BB = protect( GDB_BB)
-- Costanti per info di sistema
GDB_SI = {
'GDB_SI.',
SOURCE = "!SOU",
BASE = "!BAS",
LIST = "!LST",
COPY = "!COP",
MGRPONLY = "!MGO"
}
GDB_SI = protect( GDB_SI)
-- Costanti per tipologia di riferimento
GDB_FR = {
'GDB_FR.',
TOP = 1,
BOTTOM = 2,
FRONT = 3,
BACK = 4,
LEFT = 5,
RIGHT = 6
}
GDB_FR = protect( GDB_FR)
-- Costanti per posizione inserimento testo rispetto al punto di riferimento
GDB_TI = {
'GDB_TI.',
TL = 1,
TC = 2,
TR = 3,
ML = 4,
MC = 5,
MR = 6,
BL = 7,
BC = 8,
BR = 9
}
GDB_TI = protect( GDB_TI)
-- Costanti per interpolazione punti
GDB_PI = {
'GDB_PI.',
ARCS = 0,
ARCS_CORNER = 1,
CUBICS = 2
}
GDB_PI = protect( GDB_PI)
-- Costanti per approssimazione curve
GDB_CA = {
'GDB_CA.',
LINES = 0,
SPECIAL_LINES = 10,
LEFT_LINES = 1,
LEFT_CONVEX_LINES = 11,
RIGHT_LINES = 2,
RIGHT_CONVEX_LINES = 12,
ARCS = 3
}
GDB_CA = protect( GDB_CA)
-- Costanti per tipo offset di curve
GDB_OT = {
'GDB_OT.',
FILLET = 0,
CHAMFER = 1,
EXTEND = 2
}
GDB_OT = protect( GDB_OT)
-- Costanti per classificazione reciproca di regioni
GDB_RC = {
'GDB_RC.',
NULL = 0,
IN1 = 1,
IN2 = 2,
SAME = 3,
OUT = 4,
INTERS = 5
}
GDB_RC = protect( GDB_RC)
-- Costanti per classificazione curva rispetto a regione
GDB_CRC = {
'GDB_CRC.',
NULL = 0,
IN = 1,
OUT = 2,
ON = 3,
INTERS = 4
}
GDB_CRC = protect( GDB_CRC)
-- Costanti tipo punto intersezione Linea SurfTriMesh
GDB_SLT = {
'GDB_SLT.',
NULL = 0,
IN = 1,
OUT = 2,
TG_INI = 3,
TG_FIN = 4,
TOUCH = 5
}
GDB_SLT = protect( GDB_SLT)
-- Costanti tipo costruzione superficie rigata
GDB_RUL = {
'GDB_RUL.',
ISOPAR = 'IP',
MINDIST = 'MD'
}
GDB_RUL = protect( GDB_RUL)
-- Costanti scena per tipo visualizzazione
SCE_SM = {
'SCE_SM.',
WF = 0,
HL = 1,
SH = 2
}
SCE_SM = protect( SCE_SM)
-- Costanti scena per tipo zoom
SCE_ZM = {
'SCE_ZM.',
ALL = 1,
IN = 2,
OUT = 3
}
SCE_ZM = protect( SCE_ZM)
-- Costanti scena per tipo vista
SCE_VD = {
'SCE_VD.',
NONE = 0,
TOP = 1,
FRONT = 2,
RIGHT = 3,
BACK = 4,
LEFT = 5,
BOTTOM = 6,
ISO_SW = 7,
ISO_SE = 8,
ISO_NE = 9,
ISO_NW = 10,
GRID = 11
}
SCE_VD = protect( SCE_VD)
-- Flag per import CNC
EIC_FL = {
'EIC_FL.',
NONE = 0,
CHAIN = 1,
SKIP_ZEROMACH = 2,
SKIP_RAPID = 4
}
EIC_FL = protect( EIC_FL)
-- Flag per import BTL
EIB_FL = {
'EIB_FL.',
NONE = 0,
FLAT_POS = 1,
VERT_POS = 2,
SPECIAL_TRIM = 4,
TS3_POS = 8,
SORT = 16,
USEUATTR = 32
}
EIB_FL = protect( EIB_FL)
-- Flag per export
EEX_FL = {
'EEX_FL.',
NONE = 0,
COMP_LAYER = 1,
COL_BY_LAYER = 2,
ADV_NAMES = 4
}
EEX_FL = protect( EEX_FL)
-- Costanti shortest path per tipo di percorso di ottimizzazione
SHP_TY = {
'SHP_TY.',
NONE = 0,
CLOSED = 1,
OPEN = 2,
ZIGZAG_X = 3,
ZIGZAG_Y = 4,
ONEWAY_XP = 5,
ONEWAY_XM = 6,
ONEWAY_YP = 7,
ONEWAY_YM = 8
}
SHP_TY = protect( SHP_TY)
-- Costanti shortest path per tipo estremo di percorso aperto
SHP_OB = {
'SHP_OB.',
NONE = 0,
NEAR_PNT = 1,
XMIN = 2,
XMAX = 3,
YMIN = 4,
YMAX = 5
}
SHP_OB = protect( SHP_OB)
-- Costanti nesting per interferenza lavorazione
NST_FMI = {
'NST_FMI.',
NONE = 0,
LI = 1,
RM = 2,
LO = 4
}
NST_FMI = protect( NST_FMI)
-- Costanti nesting automatico per corner di partenza
NST_CORNER = {
'NST_CORNER.',
BL = 0,
TL = 1,
BR = 2,
TR = 3
}
NST_CORNER = protect( NST_CORNER)
-- Costanti lavorazioni per tipo di tavola della macchina
MCH_TT = {
'MCH_TT.',
FLAT = 1
}
MCH_TT = protect( MCH_TT)
-- Costanti lavorazioni per tipo assi della macchina
MCH_AT = {
'MCH_AT.',
LINEAR = 1,
ROTARY = 2
}
MCH_AT = protect( MCH_AT)
-- Costanti lavorazioni per tipo teste della macchina (standard o multipla)
MCH_HT = {
'MCH_HT.',
STD = 1,
MULTI = 2,
SPECIAL = 3
}
MCH_HT = protect( MCH_HT)
-- Costanti lavorazioni per criterio scelta soluzione (Solution Choice Criterion)
-- STD e OPPOSITE si possono usare solo nelle operazioni (non nelle teste)
MCH_SCC = {
'MCH_SCC.',
NONE = 0,
STD = 1,
OPPOSITE = 2,
ADIR_XP = 11,
ADIR_XM = 12,
ADIR_YP = 13,
ADIR_YM = 14,
ADIR_ZP = 15,
ADIR_ZM = 16,
ADIR_NEAR = 21,
ADIR_FAR = 22
}
MCH_SCC = protect( MCH_SCC)
-- Costanti lavorazioni per posizionamento grezzo su corner
MCH_CR = {
'MCH_CR.',
TL = 1,
TR = 2,
BL = 3,
BR = 4
}
MCH_CR = protect( MCH_CR)
-- Costanti lavorazioni per posizionamento grezzo su centro
MCH_CE = {
'MCH_CE.',
TC = 1,
ML = 2,
MR = 3,
BC = 4,
MC = 5
}
MCH_CE = protect( MCH_CE)
-- Costanti lavorazioni per famiglia utensile
MCH_TF = {
'MCH_TF.',
DRILLBIT = 256,
SAWBLADE = 512,
MILL = 1024,
MORTISE = 2048,
CHISEL = 4096,
WATERJET = 8192,
COMPO = 16384
}
MCH_TF = protect( MCH_TF)
-- Costanti lavorazioni per tipologia utensile
MCH_TY = {
'MCH_TY.',
NONE = 0,
DRILL_STD = 256,
DRILL_LONG = 257,
SAW_STD = 512,
SAW_FLAT = 513,
MILL_STD = 1024,
MILL_NOTIP = 1025,
MILL_POLISHING = 1026,
MORTISE_STD = 2048,
CHISEL_STD = 4096,
WATERJET = 8192,
COMPO = 16384
}
MCH_TY = protect( MCH_TY)
-- Costanti lavorazioni per tipo parametri di utensili
MCH_TP = {
'MCH_TP.',
ACTIVE = 4096,
CORR = 8192,
EXIT = 8193,
TYPE = 8194,
COOLANT = 8195,
CORNRAD = 16384,
DIAM = 16385,
TOTDIAM = 16386,
FEED = 16387,
ENDFEED = 16388,
STARTFEED = 16389,
TIPFEED = 16390,
LEN = 16391,
TOTLEN = 16392,
MAXMAT = 16393,
LONOFFSET = 16394,
RADOFFSET = 16395,
SPEED = 16396,
SIDEANG = 16397,
MAXSPEED = 16398,
THICK = 16399,
MAXABSORPTION = 16400,
MINFEED = 16401,
DRAW = 32768,
HEAD = 32769,
NAME = 32770,
SYSNOTES = 32771,
USERNOTES = 32772,
TCPOS = 32773,
UUID = 32774
}
MCH_TP = protect( MCH_TP)
-- Costanti lavorazioni per tipologia operazione
MCH_OY = {
'MCH_OY.',
NONE = 0,
DISP = 256,
DRILLING = 512,
SAWING = 1024,
MILLING = 2048,
POCKETING = 4096,
MORTISING = 8192,
SAWROUGHING = 16384,
SAWFINISHING = 32768,
GENMACHINING = 65536,
CHISELING = 131072,
SURFROUGHING = 262144,
SURFFINISHING = 524288,
WATERJETTING = 1048576
}
MCH_OY = protect( MCH_OY)
-- Costanti lavorazioni per tipologia lavorazione
MCH_MY = {
'MCH_MY.',
NONE = MCH_OY.NONE,
DRILLING = MCH_OY.DRILLING,
SAWING = MCH_OY.SAWING,
MILLING = MCH_OY.MILLING,
POCKETING = MCH_OY.POCKETING,
MORTISING = MCH_OY.MORTISING,
SAWROUGHING = MCH_OY.SAWROUGHING,
SAWFINISHING = MCH_OY.SAWFINISHING,
GENMACHINING = MCH_OY.GENMACHINING,
CHISELING = MCH_OY.CHISELING,
SURFROUGHING = MCH_OY.SURFROUGHING,
SURFFINISHING = MCH_OY.SURFFINISHING,
WATERJETTING = MCH_OY.WATERJETTING
}
MCH_MY = protect( MCH_MY)
-- Costanti lavorazioni per parametri generali delle lavorazioni
MCH_GP = {
'MCH_GP.',
SPLITARCS = 8192,
SAFEZ = 16384,
EXTRALONCUTREG = 16385,
EXTRARONDRIREG = 16386,
HOLEDIAMTOLER = 16387,
EXTSAWARCMINRAD = 16388,
INTSAWARCMAXSIDEANG = 16389,
SAFEAGGRBOTTZ = 16390,
MAXDEPTHSAFE = 16391
}
MCH_GP = protect( MCH_GP)
-- Costanti spezzatura archi
MCH_SPLAR ={
'MCH_SPLAR.',
NEVER = 0,
GEN_PLANE = 1,
NO_XY_PLANE = 2,
ALWAYS = 3
}
MCH_SPLAR = protect( MCH_SPLAR)
-- Costanti lavorazioni per tipo parametri di lavorazione
MCH_MP = {
'MCH_MP.',
INVERT = 4096,
LEAVETAB = 4097,
TOOLINVERT = 4098,
PROBING = 4099,
LIHOLE = 4100,
OSCENABLE = 4101,
TYPE = 8192,
WORKSIDE = 8193,
HEADSIDE = 8194,
LEADINTYPE = 8195,
EXTLINKTYPE = 8196,
LEADOUTTYPE = 8197,
CURVEUSE = 8198,
STEPTYPE = 8199,
SUBTYPE = 8200,
LEADLINKTYPE = 8201,
SCC = 8202,
FACEUSE = 8203,
EXTCORNERTYPE = 8204,
INTCORNERTYPE = 8205,
CORNERSLOWPERC = 8206,
LPTURNS = 8207,
HPTURNS = 8208,
TABMIN = 8209,
TABMAX = 8210,
SPEED = 16384,
TOOLSPEED = 16384, -- per compatibilità
FEED = 16385,
STARTFEED = 16386,
ENDFEED = 16387,
TIPFEED = 16388,
OFFSR = 16389,
OFFSL = 16390,
DEPTH = 16391,
SIDEANGLE = 16392,
APPROX = 16393,
STARTPOS = 16394,
STARTSLOWLEN = 16395,
ENDSLOWLEN = 16396,
THROUADDLEN = 16397,
STEP = 16398,
RETURNPOS = 16399,
OVERLAP = 16400,
TABLEN = 16401,
TABDIST = 16402,
TABHEIGHT = 16403,
TABANGLE = 16404,
LITANG = 16405,
LIPERP = 16406,
LIELEV = 16407,
LICOMPLEN = 16408,
LOTANG = 16409,
LOPERP = 16410,
LOELEV = 16411,
LOCOMPLEN = 16412,
STARTADDLEN = 16413,
ENDADDLEN = 16414,
OFFSET = 16415,
STEPEXTARC = 16416,
STEPINTARC = 16417,
SIDESTEP = 16418,
VERTFEED = 16419,
STEPSIDEANG = 16420,
OVERL = 16421,
STEPBACK = 16422,
STEPSIDEANGBACK = 16423,
BACKFEED = 16424,
LIHOLERAD = 16425,
FORWARDANGLE = 16426,
PROBINGMINDIST =16427,
PROBINGMAXDIST =16428,
CORNERSLOWLEN = 16429,
THICKREF = 16430,
OSCHEIGHT = 16431,
OSCRAMPLEN = 16432,
OSCFLATLEN = 16433,
SIDEANGFEED = 16434,
STEPLAST = 16435,
EPICYCLESRAD = 16436,
EPICYCLESDIST = 16437,
NAME = 32768,
TOOL = 32769,
DEPTH_STR = 32770,
TUUID = 32771,
UUID = 32772,
SYSNOTES = 32773,
USERNOTES = 32774,
OVERLAP_STR = 32775,
OFFSET_STR = 32776,
INITANGS= 32777,
BLOCKEDAXIS= 32778
}
MCH_MP = protect( MCH_MP)
-- Costanti foratura per sottotipo lavorazione
MCH_DRI_SUB = {
'MCH_DRI_SUB.',
STD = 0,
ALONG_CURVE = 1
}
MCH_DRI_SUB = protect( MCH_DRI_SUB)
-- Costanti lavorazioni lama per lato di lavoro
MCH_SAW_WS = {
'MCH_SAW_WS.',
CENTER = 0,
LEFT = 1,
RIGHT = 2
}
MCH_SAW_WS = protect( MCH_SAW_WS)
-- Costanti lavorazioni lama per lato testa
MCH_SAW_HS = {
'MCH_SAW_HS.',
LEFT = 1,
RIGHT = 2
}
MCH_SAW_HS = protect( MCH_SAW_HS)
-- Costanti lavorazioni lama per tipo di step
MCH_SAW_ST = {
'MCH_SAW_ST.',
ZIGZAG = 0,
ONEWAY = 1,
TOANDFROM = 2
}
MCH_SAW_ST = protect( MCH_SAW_ST)
-- Costanti lavorazioni lama per tipo di attacco
MCH_SAW_LI = {
'MCH_SAW_LI.',
CENT = 0,
STRICT = 1,
OUT = 2,
EXT_CENT = 3,
EXT_OUT = 4
}
MCH_SAW_LI = protect( MCH_SAW_LI)
-- Costanti lavorazioni lama per link esterno
MCH_SAW_EL = {
'MCH_SAW_EL.',
CENT = 0,
EXT_PREV = 1,
EXT_NEXT = 2,
EXT_BOTH = 3
}
MCH_SAW_EL = protect( MCH_SAW_EL)
-- Costanti lavorazioni lama per tipo di uscita ( EXT conservato per compatibilità)
MCH_SAW_LO = {
'MCH_SAW_LO.',
CENT = 0,
STRICT = 1,
EXT = 2,
EXT_CENT = 2,
OUT = 3,
EXT_OUT = 4
}
MCH_SAW_LO = protect( MCH_SAW_LO)
-- Costanti lavorazioni lama per gestione curve
MCH_SAW_CRV = {
'MCH_SAW_CRV.',
SKIP = 0,
APPROX = 1,
CONVEX = 2,
KEEP = 3
}
MCH_SAW_CRV = protect( MCH_SAW_CRV)
-- Costanti lavorazioni fresa per lato di lavoro
MCH_MILL_WS = {
'MCH_MILL_WS.',
CENTER = 0,
LEFT = 1,
RIGHT = 2
}
MCH_MILL_WS = protect( MCH_MILL_WS)
-- Costanti lavorazioni fresa per tipo di step
MCH_MILL_ST = {
'MCH_MILL_ST.',
ZIGZAG = 0,
ONEWAY = 1,
SPIRAL = 2
}
MCH_MILL_ST = protect( MCH_MILL_ST)
-- Costanti lavorazioni fresa per tipo di attacco
MCH_MILL_LI = {
'MCH_MILL_LI.',
NONE = 0,
LINEAR = 1,
TANGENT = 2,
GLIDE = 3,
ZIGZAG = 4,
HELIX = 5,
TG_PERP = 6
}
MCH_MILL_LI = protect( MCH_MILL_LI)
-- Costanti lavorazioni fresa per tipo di uscita
MCH_MILL_LO = {
'MCH_MILL_LO.',
NONE = 0,
LINEAR = 1,
TANGENT = 2,
GLIDE = 3,
AS_LI = 4,
PERP_TG = 5
}
MCH_MILL_LO = protect( MCH_MILL_LO)
-- Costanti lavorazioni fresa per tipo lavorazione faccia
MCH_MILL_FU = {
'MCH_MILL_FU.',
NONE = 0,
PARAL_DOWN = 1,
PARAL_TOP = 2,
PARAL_FRONT = 3,
PARAL_BACK = 4,
PARAL_LEFT = 5,
PARAL_RIGHT = 6,
ORTHO_DOWN = 33,
ORTHO_TOP = 34,
ORTHO_FRONT = 35,
ORTHO_BACK = 36,
ORTHO_LEFT = 37,
ORTHO_RIGHT = 38,
ORTHO_CONT = 39,
ORTUP_DOWN = 65,
ORTUP_TOP = 66,
ORTUP_FRONT = 67,
ORTUP_BACK = 68,
ORTUP_LEFT = 69,
ORTUP_RIGHT = 70,
ORTUP_CONT = 71
}
MCH_MILL_FU = protect( MCH_MILL_FU)
-- Costanti lavorazioni svuotatura per sottotipo
MCH_POCK_SUB = {
'MCH_POCK_SUB.',
ZIGZAG = 0,
ONEWAY = 1,
SPIRALIN = 2,
SPIRALOUT = 3
}
MCH_POCK_SUB = protect( MCH_POCK_SUB)
-- Costanti lavorazioni svuotatura per tipo di attacco
MCH_POCK_LI = {
'MCH_POCK_LI.',
NONE = 0,
GLIDE = 1,
ZIGZAG = 2,
HELIX = 3
}
MCH_POCK_LI = protect( MCH_POCK_LI)
-- Costanti lavorazioni svuotatura per tipo di uscita
MCH_POCK_LO = {
'MCH_POCK_LO.',
NONE = 0,
GLIDE = 1
}
MCH_POCK_LO = protect( MCH_POCK_LO)
-- Costanti lavorazioni sgrossatura con lama per lato testa
MCH_SAWROU_HS = {
'MCH_SAWROU_HS.',
LEFT = 1,
RIGHT = 2
}
MCH_SAWROU_HS = protect( MCH_SAWROU_HS)
-- Costanti lavorazioni sgrossatura con lama per tipo di step
MCH_SAWROU_ST = {
'MCH_SAWROU_ST.',
ZIGZAG = 0,
ONEWAY = 1
}
MCH_SAWROU_ST = protect( MCH_SAWROU_ST)
-- Costanti lavorazioni sgrossatura con lama per tipo di attacco
MCH_SAWROU_LL = {
'MCH_SAWROU_LL.',
CENT = 0,
OUT = 1
}
MCH_SAWROU_LL = protect( MCH_SAWROU_LL)
-- Costanti lavorazioni finitura con lama per lato testa
MCH_SAWFIN_HS = {
'MCH_SAWFIN_HS.',
LEFT = 1,
RIGHT = 2
}
MCH_SAWFIN_HS = protect( MCH_SAWFIN_HS)
-- Costanti lavorazioni finitura con lama per tipo di step
MCH_SAWFIN_ST = {
'MCH_SAWFIN_ST.',
ZIGZAG = 0,
ONEWAY = 1
}
MCH_SAWFIN_ST = protect( MCH_SAWFIN_ST)
-- Costanti lavorazioni finitura con lama per tipo di attacco
MCH_SAWFIN_LL = {
'MCH_SAWFIN_LL.',
CENT = 0,
OUT = 1
}
MCH_SAWFIN_LL = protect( MCH_SAWFIN_LL)
-- Costanti lavorazioni scalpellatura per lato di lavoro
MCH_CHISEL_WS = {
'MCH_CHISEL_WS.',
LEFT = 1,
RIGHT = 2
}
MCH_CHISEL_WS = protect( MCH_CHISEL_WS)
-- Costanti lavorazioni mortasatura per lato di lavoro
MCH_MORTISE_WS = {
'MCH_MORTISE_WS.',
LEFT = 1,
RIGHT = 2
}
MCH_MORTISE_WS = protect( MCH_MORTISE_WS)
-- Costanti lavorazioni mortasatura per tipo di step
MCH_MORTISE_ST = {
'MCH_MORTISE_ST.',
ZIGZAG = 0,
ONEWAY = 1
}
MCH_MORTISE_ST = protect( MCH_MORTISE_ST)
-- Costanti lavorazioni fresa per tipo lavorazione faccia
MCH_MORTISE_FU = {
'MCH_MORTISE_FU.',
NONE = 0,
PARAL_DOWN = 1,
PARAL_TOP = 2,
PARAL_FRONT = 3,
PARAL_BACK = 4,
PARAL_LEFT = 5,
PARAL_RIGHT = 6
}
MCH_MORTISE_FU = protect( MCH_MORTISE_FU)
-- Costanti lavorazioni getto d'acqua per lato di lavoro
MCH_WJET_WS = {
'MCH_WJET_WS.',
CENTER = 0,
LEFT = 1,
RIGHT = 2
}
MCH_WJET_WS = protect( MCH_WJET_WS)
-- Costanti lavorazioni getto d'acqua per comportamento su angolo esterno
MCH_WJET_EC = {
'MCH_WJET_EC.',
NONE = 0,
SLOW = 1,
LOOP = 2
}
MCH_WJET_EC = protect( MCH_WJET_EC)
-- Costanti lavorazioni getto d'acqua per comportamento su angolo interno
MCH_WJET_IC = {
'MCH_WJET_IC.',
NONE = 0,
SLOW = 1,
}
MCH_WJET_IC = protect( MCH_WJET_IC)
-- Costanti lavorazioni getto d'acqua per tipo di attacco
MCH_WJET_LI = {
'MCH_WJET_LI.',
NONE = 0,
LINEAR = 1,
TANGENT = 2
}
MCH_WJET_LI = protect( MCH_WJET_LI)
-- Costanti lavorazioni getto d'acqua per tipo di uscita
MCH_WJET_LO = {
'MCH_WJET_LO.',
NONE = 0,
LINEAR = 1,
TANGENT = 2,
AS_LI = 4
}
MCH_WJET_LO = protect( MCH_WJET_LO)
-- Costanti lavorazioni per stato simulazione
MCH_SIM = {
'MCH_SIM.',
OK = 0,
END_STEP = 1,
END = 2,
STOP = 3,
OUTSTROKE = 4,
DIR_ERR = 5,
COLLISION = 6,
ERR = 7
}
MCH_SIM = protect( MCH_SIM)
-- Costanti lavorazioni per stato utente di simulazione
MCH_UISIM = {
'MCH_UISIM.',
NULL = 0,
STOP = 1,
PLAY = 2,
STEP = 3,
PAUSE = 4
}
MCH_UISIM = protect( MCH_UISIM)
-- Costanti errore simulatore in cieco
MCH_SHE = {
'MCH_SHE.',
NONE = 0,
INIT = 1,
OUTSTROKE = 2,
DIR_ERR = 3,
COLLISION = 4,
SPECIAL = 5,
GENERAL = 6
}
MCH_SHE = protect( MCH_SHE)
-- Costanti per tipi oggetti per collisioni in simulatore
MCH_SIM_COB = {
'MCH_SIM_COB.',
NONE = 0,
BOX = 1,
CYL = 2,
SPHE = 3,
CONE = 4
}
MCH_SIM_COB = protect( MCH_SIM_COB)
--Costanti : stato visualizzazione macchina
MCH_LOOK = {
'MCH_LOOK.',
TAB = 0,
TAB_TOOL = 1,
TAB_HEAD = 2,
ALL = 3
}
MCH_LOOK = protect( MCH_LOOK)
return EgtConst
@@ -0,0 +1,494 @@
-- EgtDimension.lua by EgalTech s.r.l. 2019/032/31
-- Creazione di una quota
-- Tavola per definizione modulo (serve ma non usata)
local EgtDimension = {}
EgtOutLog( 'EgtDimension started', 1)
-- Intestazioni
require( 'EgtBase')
-- Frecce agli estremi della linea di quotatura
function Arrows(nParentId, ptP1, ptP2, dLenArr, iFrame, cColor, bRadius)
local Ang = atan2( (ptP2:getY() - ptP1:getY()), (ptP2:getX() - ptP1:getX()))
local iLine1
local iLine2
if not bRadius then
iLine1 = EgtLinePDL(nParentId, ptP1, Ang + 30, dLenArr, iFrame)
iLine2 = EgtLinePDL(nParentId, ptP1, Ang - 30, dLenArr, iFrame)
end
local iLine3 = EgtLinePDL(nParentId, ptP2, Ang + 150, dLenArr, iFrame)
local iLine4 = EgtLinePDL(nParentId, ptP2, Ang - 150, dLenArr, iFrame)
if cColor then
if not bRadius then
EgtSetColor( iLine1, cColor)
EgtSetColor( iLine2, cColor)
end
EgtSetColor( iLine3, cColor)
EgtSetColor( iLine4, cColor)
end
end
-- Quota verticale (bSide: false sx, true dx)
function CreateLinearDimensionOnY( nParentId, ptP1, ptP2, sText, iTextSize, dDistance, dLenArr, dDistText, bSide, sVar, iFrame, cColor)
if not iFrame then
iFrame = GDB_RT.LOC
end
local ptSx -- punto a sinistra
local ptDx -- punto a destra
if ptP1:getX() < ptP2:getX() - GEO.EPS_SMALL then
ptSx = Point3d(ptP1)
ptDx = Point3d(ptP2)
else
ptSx = Point3d(ptP2)
ptDx = Point3d(ptP1)
end
if not bSide then -- Quotatura a sinistra
if abs(ptSx:getY() - ptDx:getY()) < GEO.EPS_SMALL then -- Caso di quota nulla
local Uvx = Vector3d(-1, 0, 0)
local iLine = EgtLinePVL(nParentId, ptDx, Uvx, dDistance + ptDx:getX() - ptSx:getX(), iFrame)
local pText = Point3d(ptSx:getX() - dDistance - dDistText, ptSx:getY(),0)
local TextId = EgtTextAdv(nParentId, pText, 0, sText,"", 400,"S", iTextSize, 1, 0, GDB_TI.MR,iFrame)
EgtSetInfo( TextId, 'Var', sVar)
if cColor then
EgtSetColor( iLine, cColor)
EgtSetColor( TextId, cColor)
end
else -- Caso di quota non nulla
local ptSx1 = Point3d(ptSx:getX() - dDistance, ptSx:getY(), 0)
local ptDx1 = Point3d(ptSx:getX() - dDistance, ptDx:getY(), 0)
local iLine1 = EgtLine(nParentId, ptSx, ptSx1, iFrame)
local iLine2 = EgtLine(nParentId, ptDx, ptDx1, iFrame)
local ptSx2 = Point3d(ptSx:getX() - (dDistance - 0.5 * dLenArr), ptSx:getY(), 0)
local ptDx2 = Point3d(ptSx:getX() - (dDistance - 0.5 * dLenArr), ptDx:getY(), 0)
local iLine3 = EgtLine(nParentId, ptSx2, ptDx2, iFrame)
Arrows(nParentId, ptSx2, ptDx2, dLenArr, iFrame, cColor)
local pText = Point3d(ptSx1:getX() - dDistText, (ptSx1:getY() + ptDx1:getY())/2,0)
local TextId = EgtTextAdv(nParentId, pText, 0, sText,"", 400,"S", iTextSize, 1, 0, GDB_TI.MR)
EgtSetInfo( TextId, 'Var', sVar)
if cColor then
EgtSetColor( iLine1, cColor)
EgtSetColor( iLine2, cColor)
EgtSetColor( iLine3, cColor)
EgtSetColor( TextId, cColor)
end
end
else -- Quotatura a destra
if abs(ptSx:getY() - ptDx:getY()) < GEO.EPS_SMALL then -- Caso di quota nulla
local Uvx = Vector3d(1, 0, 0)
local iLine = EgtLinePVL(nParentId, ptSx, Uvx, dDistance + ptDx:getX() - ptSx:getX(), iFrame)
local pText = Point3d(ptDx:getX() + dDistance + dDistText, ptSx:getY(),0)
local TextId = EgtTextAdv(nParentId, pText, 0, sText,"", 400,"S", iTextSize, 1, 0, GDB_TI.ML,iFrame)
EgtSetInfo( TextId, 'Var', sVar)
if cColor then
EgtSetColor( iLine, cColor)
EgtSetColor( TextId, cColor)
end
else -- Caso di quota non nulla
local ptSx1 = Point3d(ptDx:getX() + dDistance, ptSx:getY(), 0)
local ptDx1 = Point3d(ptDx:getX() + dDistance, ptDx:getY(), 0)
local iLine1 = EgtLine(nParentId, ptSx, ptSx1, iFrame)
local iLine2 = EgtLine(nParentId, ptDx, ptDx1, iFrame)
local ptSx2 = Point3d(ptDx:getX() + (dDistance - 0.5 * dLenArr), ptSx:getY(), 0)
local ptDx2 = Point3d(ptDx:getX() + (dDistance - 0.5 * dLenArr), ptDx:getY(), 0)
local iLine3 = EgtLine(nParentId, ptSx2, ptDx2, iFrame)
Arrows(nParentId, ptSx2, ptDx2, dLenArr, iFrame, cColor)
local pText = Point3d(ptDx1:getX() + dDistText, (ptSx1:getY() + ptDx1:getY())/2,0)
local TextId = EgtTextAdv(nParentId, pText, 0, sText,"", 400,"S", iTextSize, 1, 0, GDB_TI.ML,iFrame)
EgtSetInfo( TextId, 'Var', sVar)
if cColor then
EgtSetColor( iLine1, cColor)
EgtSetColor( iLine2, cColor)
EgtSetColor( iLine3, cColor)
EgtSetColor( TextId, cColor)
end
end
end
end
-- Quota orizzontale (bSide: false down, true up)
function CreateLinearDimensionOnX( nParentId, ptP1, ptP2, sText, iTextSize, dDistance, dLenArr, dDistText, bSide, sVar, iFrame, cColor, bRadius, bShiftLeft)
if not iFrame then
iFrame = GDB_RT.LOC
end
local ptDw -- punto in basso
local ptUp -- punto in alto
if ptP1:getY() < ptP2:getY() - GEO.EPS_SMALL then
ptDw = Point3d( ptP1)
ptUp = Point3d( ptP2)
else
ptDw = Point3d( ptP2)
ptUp = Point3d( ptP1)
end
-- Quotatura in basso
if not bSide then
-- Caso di quota nulla
if abs(ptDw:getX() - ptUp:getX()) < GEO.EPS_SMALL then
local UvY = Vector3d(0, -1, 0)
local iLine = EgtLinePVL(nParentId, ptUp, UvY, ptUp:getY() - ptDw:getY() + dDistance, iFrame)
local pText = Point3d(ptDw:getX(), ptDw:getY() - dDistance - dDistText,0)
local TextId = EgtTextAdv(nParentId, pText, 0, sText,"", 400,"S", iTextSize, 1, 0, GDB_TI.TC,iFrame)
EgtSetInfo( TextId, 'Var', sVar)
if bShiftLeft then
EgtMove( TextId, Vector3d(-dLenArr/2, dLenArr + abs(ptDw:getX() - ptUp:getX()) + 20, 0))
end
if cColor then
EgtSetColor( iLine, cColor)
EgtSetColor( TextId, cColor)
end
-- Caso di quota non nulla
else
local ptDw1
local ptUp1
local ptDw2
local ptUp2
local iLine1
local iLine2
if not bRadius then
ptDw1 = Point3d(ptDw:getX(), ptDw:getY() - dDistance, 0)
ptUp1 = Point3d(ptUp:getX(), ptDw:getY() - dDistance, 0)
iLine1 = EgtLine(nParentId, ptDw, ptDw1, iFrame)
iLine2 = EgtLine(nParentId, ptUp, ptUp1, iFrame)
ptDw2 = Point3d(ptDw:getX(), ptDw:getY() - (dDistance - 0.5 * dLenArr), 0)
ptUp2 = Point3d(ptUp:getX(), ptDw:getY() - (dDistance - 0.5 * dLenArr), 0)
else
ptDw1 = Point3d(ptDw:getX(), ptDw:getY(), 0)
ptUp1 = Point3d(ptUp:getX(), ptDw:getY(), 0)
ptDw2 = Point3d(ptDw:getX(), ptDw:getY(), 0)
ptUp2 = Point3d(ptUp:getX(), ptDw:getY(), 0)
end
local iLine3 = EgtLine(nParentId, ptDw2, ptUp2, iFrame)
Arrows(nParentId, ptDw2, ptUp2, dLenArr, iFrame, cColor, bRadius)
local pText = Point3d((ptDw1:getX() + ptUp1:getX())/2, ptDw1:getY() - dDistText,0)
local TextId = EgtTextAdv(nParentId, pText, 0, sText,"", 400,"S", iTextSize, 1, 0, GDB_TI.TC,iFrame)
EgtSetInfo( TextId, 'Var', sVar)
if bShiftLeft then
EgtMove( TextId, Vector3d(-dLenArr/2, dLenArr + abs(ptDw:getX() - ptUp:getX()) + 20, 0))
end
if cColor then
if not bRadius then
EgtSetColor( iLine1, cColor)
EgtSetColor( iLine2, cColor)
end
EgtSetColor( iLine3, cColor)
EgtSetColor( TextId, cColor)
end
end
-- Quotatura in alto
else
-- Caso di quota nulla
if abs( ptDw:getX() - ptUp:getX()) < GEO.EPS_SMALL then
local UvY = Vector3d(0, 1, 0)
local iLine = EgtLinePVL(nParentId, ptDw, UvY, ptUp:getY() - ptDw:getY() + dDistance, iFrame)
local pText = Point3d(ptUp:getX(), ptUp:getY() + dDistance + dDistText,0)
local TextId = EgtTextAdv(nParentId, pText, 0, sText,"", 400,"S", iTextSize, 1, 0, GDB_TI.BC,iFrame)
EgtSetInfo( TextId, 'Var', sVar)
if bShiftLeft then
EgtMove( TextId, Vector3d(-dLenArr/2, dLenArr + abs(ptDw:getX() - ptUp:getX()) + 20, 0))
end
if cColor then
EgtSetColor( iLine, cColor)
EgtSetColor( TextId, cColor)
end
-- Caso di quota non nulla
else
local ptDw1
local ptUp1
local ptDw2
local ptUp2
local iLine1
local iLine2
if not bRadius then
ptDw1 = Point3d( ptDw:getX(), ptUp:getY() + dDistance, 0)
ptUp1 = Point3d( ptUp:getX(), ptUp:getY() + dDistance, 0)
iLine1 = EgtLine( nParentId, ptDw, ptDw1, iFrame)
iLine2 = EgtLine( nParentId, ptUp, ptUp1, iFrame)
ptDw2 = Point3d( ptDw:getX(), ptUp:getY() + (dDistance - 0.5 * dLenArr), 0)
ptUp2 = Point3d( ptUp:getX(), ptUp:getY() + (dDistance - 0.5 * dLenArr), 0)
else
ptDw1 = Point3d( ptDw:getX(), ptUp:getY(), 0)
ptUp1 = Point3d( ptUp:getX(), ptUp:getY(), 0)
ptDw2 = Point3d( ptDw:getX(), ptUp:getY(), 0)
ptUp2 = Point3d( ptUp:getX(), ptUp:getY(), 0)
end
local iLine3 = EgtLine( nParentId, ptDw2, ptUp2, iFrame)
Arrows( nParentId, ptDw2, ptUp2, dLenArr, iFrame, cColor, bRadius)
local pText = Point3d( ( ptDw1:getX() + ptUp1:getX()) / 2, ptUp1:getY() + dDistText, 0)
local TextId = EgtTextAdv( nParentId, pText, 0, sText,"", 400,"S", iTextSize, 1, 0, GDB_TI.BC,iFrame)
if bShiftLeft then
EgtMove( TextId, Vector3d( -dLenArr/2, dLenArr + abs( ptDw:getX() - ptUp:getX()) + 20, 0))
end
EgtSetInfo( TextId, 'Var', sVar)
if cColor then
if not bRadius then
EgtSetColor( iLine1, cColor)
EgtSetColor( iLine2, cColor)
end
EgtSetColor( iLine3, cColor)
EgtSetColor( TextId, cColor)
end
end
end
end
-- Quota allineata (bSide: false sx, true dx)
function CreateLinearDimensionAligned( nParentId, ptP1, ptP2, sText, dTextSize, dDistance, dLenArr, dDistText, bSide, sVar, iFrame, cColor)
if not iFrame then
iFrame = GDB_RT.LOC
end
-- Se punti coincidenti, esco
if AreSamePointApprox(ptP1,ptP2) then
return false
end
-- Se quotatura orizzontale, uso questa
if abs(ptP1:getY() - ptP2:getY()) < GEO.EPS_SMALL then
-- adatto il lato
if ptP2:getX() > ptP1:getX() then
bSide = not bSide
end
CreateLinearDimensionOnX(nParentId, ptP1, ptP2, sText, dTextSize, dDistance, dLenArr, dDistText, bSide, sVar, iFrame, cColor)
return true
end
local Vv = ptP2 - ptP1
Vv:normalize()
local AngText = atan2( Vv:getY(), Vv:getX())
local bAngModif = false
if AngText > 90 then
AngText = AngText - 180
bAngModif = true
elseif AngText < - 90 then
AngText = AngText + 180
bAngModif = true
end
if bSide then
Vv:rotate(Z_AX(),-90)
if bAngModif then
PointType = GDB_TI.BC
else
PointType = GDB_TI.TC
end
else
Vv:rotate(Z_AX(),90)
if bAngModif then
PointType = GDB_TI.TC
else
PointType = GDB_TI.BC
end
end
local iLine1 = EgtLinePVL(nParentId,ptP1, Vv, dDistance, iFrame)
local iLine2 = EgtLinePVL(nParentId,ptP2, Vv, dDistance, iFrame)
local ptP1M = ptP1 + (dDistance - 0.5 * dLenArr) * Vv
local ptP2M = ptP2 + (dDistance - 0.5 * dLenArr) * Vv
local iLine3 = EgtLine(nParentId, ptP1M, ptP2M, iFrame)
Arrows(nParentId, ptP1M, ptP2M, dLenArr, iFrame, cColor)
local ptText = 0.5 * ( ptP1 + ptP2) + ( dDistance + dDistText) * Vv
local TextId = EgtTextAdv(nParentId, ptText, AngText , sText,"", 400,"S", dTextSize, 1, 0, PointType,iFrame)
EgtSetInfo( TextId, 'Var', sVar)
if cColor then
EgtSetColor( iLine1, cColor)
EgtSetColor( iLine2, cColor)
EgtSetColor( iLine3, cColor)
EgtSetColor( TextId, cColor)
end
end
-- Quota radiale (bSide: false sx, true dx)
function CreateRadialDimension( nParentId, ptC, ptP1, sText, dTextSize, dDistance, dLenArr, dDistText, bSide, sVar, iFrame, cColor)
if not iFrame then
iFrame = GDB_RT.LOC
end
-- Se punti coincidenti, esco
if AreSamePointApprox(ptC,ptP1) then
return false
end
-- Se quotatura orizzontale, uso questa
if abs( ptC:getY() - ptP1:getY()) < GEO.EPS_SMALL then
-- adatto il lato
if ptP1:getX() > ptC:getX() then
bSide = not bSide
end
CreateLinearDimensionOnX( nParentId, ptC, ptP1, sText, dTextSize, dDistance, dLenArr, dDistText, bSide, sVar, iFrame, cColor, true)
return true
end
local Vv = ptP1 - ptC
Vv:normalize()
local AngText = atan2( Vv:getY(), Vv:getX())
local bAngModif = false
if AngText > 90 then
AngText = AngText - 180
bAngModif = true
elseif AngText < - 90 then
AngText = AngText + 180
bAngModif = true
end
local ptText
if bSide == nil then
AngText = 0
Vv = - Vv
ptText = ptC + ( dDistText + 0.5 * dTextSize) * Vv
PointType = GDB_TI.MC
elseif bSide then
Vv:rotate( Z_AX(), -90)
ptText = 0.5 * ( ptC + ptP1) + ( dDistText) * Vv
PointType = EgtIf( bAngModif, GDB_TI.BC, GDB_TI.TC)
else
Vv:rotate( Z_AX(), 90)
ptText = 0.5 * ( ptC + ptP1) + ( dDistText) * Vv
PointType = EgtIf( bAngModif, GDB_TI.TC, GDB_TI.BC)
end
local iLine3 = EgtLine( nParentId, ptC, ptP1, iFrame)
Arrows( nParentId, ptC, ptP1, dLenArr, iFrame, cColor, true)
local TextId = EgtTextAdv( nParentId, ptText, AngText , sText,"", 400,"S", dTextSize, 1, 0, PointType, iFrame)
EgtSetInfo( TextId, 'Var', sVar)
if cColor then
EgtSetColor( iLine3, cColor)
EgtSetColor( TextId, cColor)
end
end
-- Quota angolare (bSide: false = text external, true dx = text internal)
function CreateAngleDimension( nParentId, ptC, dDir, sText, dTextSize, dAngVal, dAmpArc, dDistance, dLenArr, dDistText, bSide, sVar, iFrame, cColor)
if not iFrame then
iFrame = GDB_RT.LOC
end
-- Se distanza quota nulla, esco
if abs(dAmpArc) < GEO.EPS_SMALL or abs(dAngVal) < GEO.EPS_SMALL then
return false
end
-- disegno linee da quotare
local iLine1 = EgtLinePDL(nParentId, ptC, dDir, dAmpArc, iFrame)
local iLine2 = EgtLinePDL(nParentId, ptC, dDir+dAngVal, dAmpArc, iFrame)
-- prendo i punti finali delle due linee
local ptP1 = EgtEP(iLine1)
local ptP2 = EgtEP(iLine2)
-- allungo di nuovo le linee della distanza extra
EgtTrimExtendCurveByLen( iLine1, dDistance,ptP1)
EgtTrimExtendCurveByLen( iLine2, dDistance,ptP2)
-- arco
local iArc1 = EgtArcCPA( nParentId, ptC, ptP1, dAngVal, 0, iFrame)
local pPt3 = EgtMP(iArc1)
-- frecce
local iLine3
local ptP4
local nNeg = -1
if dAngVal > 0 then
nNeg = 1
end
-- faccio linee che parte da punto di freccia perpendicolare a linea di quota
iLine3 = EgtLinePDL(nParentId, ptP1, dDir+(90*nNeg), dAmpArc, iFrame)
ptP4 = EgtEP(iLine3)
EgtErase(iLine3)
-- prima freccia sulla prima linea
Arrows( nParentId, ptP4, ptP1, dLenArr, iFrame, cColor, true)
iLine3 = EgtLinePDL(nParentId, ptP2, dDir+dAngVal-(90*nNeg), dAmpArc, iFrame)
ptP4 = EgtEP(iLine3)
EgtErase(iLine3)
-- seconda freccia sulla seconda linea
Arrows( nParentId, ptP4, ptP2, dLenArr, iFrame, cColor, true)
local Vv = ptP1 - ptC
Vv:normalize()
local AngText = 0
local bAngModif = false
local ptText
if bSide == nil then
ptText = pPt3 + ( dDistText + 0.5 * dTextSize) * Vv
PointType = GDB_TI.MC
elseif bSide then
ptText = pPt3 + ( dDistText + 0.5 * dTextSize) * Vv
PointType = GDB_TI.MC
else
ptText = pPt3 - ( dDistText + 0.5 * dTextSize) * Vv
PointType = GDB_TI.MC
end
local TextId = EgtTextAdv( nParentId, ptText, AngText , sText,"", 400,"S", dTextSize, 1, 0, PointType, iFrame)
EgtSetInfo( TextId, 'Var', sVar)
if cColor then
EgtSetColor( iLine1, cColor)
EgtSetColor( iLine2, cColor)
EgtSetColor( iArc1, cColor)
EgtSetColor( TextId, cColor)
end
end
return EgtDimension
@@ -0,0 +1,263 @@
-- EgtFrame3d.lua by EgalTech s.r.l. 2020/09/29
-- Tavola per definizione modulo (serve ma non usata)
local EgtFrame3d = {}
EgtOutLog( 'EgtFrame3d started', 1)
-- Include
require( 'EgtPoint3d')
--EnableDebug( false)
-- Definizione classe Frame3d
Frame3d = {{},{},{},{}}
Frame3d.__index = Frame3d
-- funzione di utilita' per identificazione tipo
function isFrame3d( a)
return ( getmetatable( a) == Frame3d)
end
local function New( a, b, c, d)
local f3d = setmetatable( {{0,0,0},{1,0,0},{0,1,0},{0,0,1}}, Frame3d)
local function SetVersors( type)
if type == GDB_FR.FRONT then
f3d[2] = X_AX() ; f3d[3] = Z_AX() ; f3d[4] = -Y_AX()
elseif type == GDB_FR.RIGHT then
f3d[2] = Y_AX() ; f3d[3] = Z_AX() ; f3d[4] = X_AX()
elseif type == GDB_FR.BACK then
f3d[2] = -X_AX() ; f3d[3] = Z_AX() ; f3d[4] = Y_AX()
elseif type == GDB_FR.LEFT then
f3d[2] = -Y_AX() ; f3d[3] = Z_AX() ; f3d[4] = -X_AX()
elseif type == GDB_FR.BOTTOM then
f3d[2] = X_AX() ; f3d[3] = -Y_AX() ; f3d[4] = -Z_AX()
else -- GDB_FR.TOP
f3d[2] = X_AX() ; f3d[3] = Y_AX() ; f3d[4] = Z_AX()
end
end
if not a then
f3d[1] = Point3d( 0, 0, 0)
SetVersors( GDB_FR.TOP)
elseif isFrame3d( a) then
f3d[1] = a[1]
f3d[2] = a[2]
f3d[3] = a[3]
f3d[4] = a[4]
elseif type(a) == 'table' and #a >= 4 and
type(a[1]) == 'table' and #a[1] >= 3 and
type(a[2]) == 'table' and #a[2] >= 3 and
type(a[3]) == 'table' and #a[3] >= 3 and
type(a[4]) == 'table' and #a[4] >= 3 then
f3d[1] = Point3d( a[1])
f3d[2] = Vector3d( a[2])
f3d[3] = Vector3d( a[3])
f3d[4] = Vector3d( a[4])
f3d[2]:normalize()
f3d[3]:normalize()
f3d[4]:normalize()
if not Frame3d.isValid( f3d) then
error( 'Error in FrameIsValid', 2)
end
elseif isPoint3d( a) and isVector3d( b) and isVector3d( c) and isVector3d( d) then
f3d[1] = a
f3d[2] = b
f3d[3] = c
f3d[4] = d
f3d[2]:normalize()
f3d[3]:normalize()
f3d[4]:normalize()
if not Frame3d.isValid( f3d) then
error( 'Error in FrameIsValid', 2)
end
elseif isPoint3d( a) and isVector3d( b) then
local bOk, Ocs = EgtFrameOCS( a, b)
if bOk then
f3d[1] = Point3d( Ocs[1])
f3d[2] = Vector3d( Ocs[2])
f3d[3] = Vector3d( Ocs[3])
f3d[4] = Vector3d( Ocs[4])
else
error( 'Error in EgtFrameOCS', 2)
end
elseif isPoint3d( a) and isPoint3d( b) and isPoint3d( c) then
local bOk, f3P = EgtFrameFrom3Points( a, b, c)
if bOk then
f3d[1] = Point3d( f3P[1])
f3d[2] = Vector3d( f3P[2])
f3d[3] = Vector3d( f3P[3])
f3d[4] = Vector3d( f3P[4])
else
error( 'Error in EgtFrameFrom3Points', 2)
end
elseif isPoint3d( a) then
f3d[1] = a
SetVersors( b)
elseif type(a) == 'number' and type( b) == 'number' and type( c) == 'number' then
f3d[1] = Point3d( a, b, c)
SetVersors( d)
else
error( 'A parameter is wrong', 2)
end
return f3d
end
setmetatable( Frame3d, { __call = function( _, ...) return New( ...) end })
-- verifica validità
function Frame3d:isValid()
-- verifico che i versori siano normalizzati
if not self[2]:isNormalized() or
not self[3]:isNormalized() or
not self[4]:isNormalized() then
return false
end
-- verifico che i versori siano mutuamente ortogonali
if math.abs( self[2][1] * self[3][1] + self[2][2] * self[3][2] + self[2][3] * self[3][3]) > GEO.EPS_ZERO or
math.abs( self[3][1] * self[4][1] + self[3][2] * self[4][2] + self[3][3] * self[4][3]) > GEO.EPS_ZERO or
math.abs( self[4][1] * self[2][1] + self[4][2] * self[2][2] + self[4][3] * self[2][3]) > GEO.EPS_ZERO then
return false
end
-- verifico il senso destrorso della terna
if Vector3d.TripleProd( self[2], self[3], self[4]) < GEO.EPS_ZERO then
return false
end
-- tutto bene
return true
end
-- traslazione
function Frame3d:move( m)
if not isFrame3d( self) then
return false
end
if isVector3d( m) then
self[1] = self[1] + m
return true
elseif type( m) == 'table' and #m >= 3 then
self[1] = self[1] + Vector3d( m)
return true
else
return false
end
end
-- rotazione
function Frame3d:rotate( ptAx, vtAx, dAngDeg)
if not isFrame3d( self) or not isPoint3d( ptAx) or not isVector3d( vtAx) or type( dAngDeg) ~= 'number' then
return false
end
local bOk, fRot = EgtFrameRotate( self, ptAx, vtAx, dAngDeg)
if bOk then
self[1] = Point3d( fRot[1])
self[2] = Vector3d( fRot[2])
self[3] = Vector3d( fRot[3])
self[4] = Vector3d( fRot[4])
end
return bOk
end
-- inversione (trasformazione inversa)
function Frame3d:invert()
if not isFrame3d( self) then
return false
end
local bOk, frInv = EgtFrameToLoc( Frame3d(), self)
if bOk then
self[1] = Point3d( frInv[1])
self[2] = Vector3d( frInv[2])
self[3] = Vector3d( frInv[3])
self[4] = Vector3d( frInv[4])
end
return bOk
end
-- trasformazione di riferimento verso globale
function Frame3d:toGlob( fTool)
if not isFrame3d( self) or not isFrame3d( fTool) then
return false
end
local bOk, fNew = EgtFrameToGlob( self, fTool)
if bOk then
self[1] = Point3d( fNew[1])
self[2] = Vector3d( fNew[2])
self[3] = Vector3d( fNew[3])
self[4] = Vector3d( fNew[4])
end
return bOk
end
-- trasformazione di riferimento verso locale
function Frame3d:toLoc( fTool)
if not isFrame3d( self) or not isFrame3d( fTool) then
return false
end
local bOk, fNew = EgtFrameToLoc( self, fTool)
if bOk then
self[1] = Point3d( fNew[1])
self[2] = Vector3d( fNew[2])
self[3] = Vector3d( fNew[3])
self[4] = Vector3d( fNew[4])
end
return bOk
end
-- trasformazione di riferimento da locale a locale
function Frame3d:locToLoc( fOri, fDest)
if not isFrame3d( self) or not isFrame3d( fOri) or not isFrame3d( fDest) then
return false
end
local bOk, fNew = EgtFrameLocToLoc( self, fOri, fDest)
if bOk then
self[1] = Point3d( fNew[1])
self[2] = Vector3d( fNew[2])
self[3] = Vector3d( fNew[3])
self[4] = Vector3d( fNew[4])
end
return bOk
end
-- restituzione componenti
function Frame3d:getOrigin()
return self[1]
end
function Frame3d:getVersX()
return self[2]
end
function Frame3d:getVersY()
return self[3]
end
function Frame3d:getVersZ()
return self[4]
end
-- conversione in stringa (tostring)
function Frame3d:__tostring()
return '('.. tostring(self[1])..','..tostring(self[2])..','..tostring(self[3])..','..tostring(self[4]) ..')'
end
-- Angoli di rotazione di Eulero da Frame
function GetRotCAC1FromFrame( frRef)
if not isFrame3d( frRef) then
return nil
end
return EgtFrameGetRotCAC1( frRef)
end
-- Angoli di rotazione attorno ad assi XYZ fissi da Frame
function GetFixedAxesRotABCFromFrame( frRef)
if not isFrame3d( frRef) then
return nil
end
return EgtFrameGetFixedAxesRotABC( frRef)
end
-- Riferimenti notevoli
function GLOB_FRM()
return Frame3d()
end
return EgtFrame3d
@@ -0,0 +1,15 @@
-- EgtLinearDimension.lua by EgalTech s.r.l. 2018/12/22
-- Creazione di una quota
-- 2018/12/22 DS Rinominato in EgtDimension, tenuto per compatibilità.
-- Tavola per definizione modulo (serve ma non usata)
local EgtLinearDimension = {}
require( 'EgtDimension')
CreateLinearDimensionRadial = CreateRadialDimension
CreateAngleDimensionRadial = CreateAngleDimension
return EgtLinearDimension
@@ -0,0 +1,279 @@
-- EgtPoint3d.lua by EgalTech s.r.l. 2019/03/31
-- Tavola per definizione modulo (serve ma non usata)
local EgtPoint3d = {}
EgtOutLog( 'EgtPoint3d started', 1)
-- Include
require( 'EgtVector3d')
--EnableDebug( false)
-- Definizione classe Point3d
Point3d = {}
Point3d.__index = Point3d
-- funzione di utilita' per identificazione tipo
function isPoint3d( a)
return ( getmetatable( a) == Point3d)
end
local function New( x, y, z)
local p3d = setmetatable( {0,0,0}, Point3d)
if not x then
return nil
elseif isPoint3d( x) then
p3d[1] = x[1]
p3d[2] = x[2]
p3d[3] = x[3]
elseif type(x) == 'table' and #x >= 3 then
p3d[1] = x[1]
p3d[2] = x[2]
p3d[3] = x[3]
elseif type( x) == 'number' and type( y) == 'number' and type( z) == 'number' then
p3d[1] = x
p3d[2] = y
p3d[3] = z
else
error( 'A parameter is wrong', 2)
end
return p3d
end
setmetatable( Point3d, { __call = function( _, ...) return New(...) end })
-- opposto di un punto (unary -)
function Point3d:__unm()
return New( - self[1], - self[2], - self[3])
end
-- somma di due punti o un punto e un vettore (+)
function Point3d.__add( a, b)
if ( isPoint3d( a) and ( isPoint3d( b) or isVector3d( b))) or
( isPoint3d( b) and ( isPoint3d( a) or isVector3d( a))) then
return New( a[1] + b[1], a[2] + b[2], a[3] + b[3])
else
error( 'A parameter is wrong', 2)
end
end
-- sottrazione di due punti o un punto e un vettore, restituisce un vettore o un punto (-)
function Point3d.__sub( a, b)
if isPoint3d( a) and isPoint3d( b) then
return Vector3d( a[1] - b[1], a[2] - b[2], a[3] - b[3])
elseif ( isPoint3d( a) and isVector3d( b)) or ( isVector3d( a) and isPoint3d( b)) then
return New( a[1] - b[1], a[2] - b[2], a[3] - b[3])
else
error( 'A parameter is wrong', 2)
end
end
-- moltiplicazione di un punto per un numero, di un numero per un punto (*)
function Point3d.__mul( a, b)
if type( a) == 'number' and isPoint3d( b) then
return New( a * b[1], a * b[2], a * b[3])
elseif isPoint3d( a) and type( b) == 'number' then
return New( a[1] * b, a[2] * b, a[3] * b)
else
error( 'A parameter is wrong', 2)
end
end
-- divisione di un punto per un numero (/)
function Point3d.__div( a, b)
if isPoint3d( a) and type( b) == 'number' then
return New( a[1] / b, a[2] / b, a[3] / b)
else
error( 'A parameter is wrong', 2)
end
end
-- traslazione
function Point3d:move( m)
if not isPoint3d( self) then
return false
end
if isVector3d( m) or ( type( m) == 'table' and #m >= 3) then
self[1] = self[1] + m[1]
self[2] = self[2] + m[2]
self[3] = self[3] + m[3]
return true
else
return false
end
end
-- rotazione
function Point3d:rotate( ptAx, vtAx, dAngDeg)
if not isPoint3d( self) or not isPoint3d( ptAx) or not isVector3d( vtAx) or not type( dAngDeg) == 'number' then
return false
end
local bOk, pRot = EgtPointRotate( self, ptAx, vtAx, dAngDeg)
if bOk then
self[1] = pRot[1]
self[2] = pRot[2]
self[3] = pRot[3]
end
return bOk
end
-- mirror
function Point3d:mirror( ptOn, vtN)
if not isPoint3d( self) or not isPoint3d( ptOn) or not isVector3d( vtN) then
return false
end
local bOk, pMir = EgtPointMirror( self, ptOn, vtN)
if bOk then
self[1] = pMir[1]
self[2] = pMir[2]
self[3] = pMir[3]
end
return bOk
end
-- trasformazione di riferimento verso globale
function Point3d:toGlob( fTool)
if not isPoint3d( self) or not isFrame3d( fTool) then
return false
end
local bOk, pNew = EgtPointToGlob( self, fTool)
if bOk then
self[1] = pNew[1]
self[2] = pNew[2]
self[3] = pNew[3]
end
return bOk
end
-- trasformazione di riferimento verso locale
function Point3d:toLoc( fTool)
if not isPoint3d( self) or not isFrame3d( fTool) then
return false
end
local bOk, pNew = EgtPointToLoc( self, fTool)
if bOk then
self[1] = pNew[1]
self[2] = pNew[2]
self[3] = pNew[3]
end
return bOk
end
-- trasformazione di riferimento da locale a locale
function Point3d:locToLoc( fOri, fDest)
if not isPoint3d( self) or not isFrame3d( fOri) or not isFrame3d( fDest) then
return false
end
local bOk, pNew = EgtPointLocToLoc( self, fOri, fDest)
if bOk then
self[1] = pNew[1]
self[2] = pNew[2]
self[3] = pNew[3]
end
return bOk
end
-- restituzione componenti
function Point3d:getX()
return self[1]
end
function Point3d:getY()
return self[2]
end
function Point3d:getZ()
return self[3]
end
-- conversione in stringa (tostring)
function Point3d:__tostring()
return "(" .. EgtNumToString( self[1], 4) .. ", "
.. EgtNumToString( self[2], 4) .. ", "
.. EgtNumToString( self[3], 4) .. ")"
end
-- calcolo quadrato della distanza tra due punti
function sqdist( a, b)
if isPoint3d( a) and isPoint3d( b) then
return ( ( a[1] - b[1]) * ( a[1] - b[1]) +
( a[2] - b[2]) * ( a[2] - b[2]) +
( a[3] - b[3]) * ( a[3] - b[3]))
else
error( 'A parameter is not a Point3d', 2)
end
end
-- calcolo distanza tra due punti
function dist( a, b)
if isPoint3d( a) and isPoint3d( b) then
return math.sqrt( ( a[1] - b[1]) * ( a[1] - b[1]) +
( a[2] - b[2]) * ( a[2] - b[2]) +
( a[3] - b[3]) * ( a[3] - b[3]))
else
error( 'A parameter is not a Point3d', 2)
end
end
-- funzioni di confronto
function AreSamePointApprox( a, b)
if isPoint3d( a) and isPoint3d( b) then
return ( a - b):isSmall()
else
return false
end
end
function AreSamePointExact( a, b)
if isPoint3d( a) and isPoint3d( b) then
return ( a - b):isZero()
else
return false
end
end
function AreSamePointEpsilon( a, b, eps)
if isPoint3d( a) and isPoint3d( b) then
return sqdist( a, b) < eps * eps
else
return false
end
end
-- Creazione di punti da stringhe di tre numeri
function PointFromString( sVal)
if not sVal then
return nil
end
local vsVal = EgtSplitString( sVal)
if not vsVal then
return nil
end
if #vsVal < 3 then
return nil
end
return Point3d( tonumber( vsVal[1]), tonumber( vsVal[2]), tonumber( vsVal[3]))
end
-- Creazione di punti da info di entità GeomDB
function PointFromInfo( nId, sKey)
PointFromString( EgtGetInfo( nId, sKey))
end
-- Punti notevoli
function ORIG()
return Point3d(0,0,0)
end
-- Punto con num aggiunto
function Point4d( P1, P2, P3, P4)
if isPoint3d( P1) and ( not P2 or type( P2) == 'number') then
return { P1[1], P1[2], P1[3], P2 or 0}
elseif type( P1) == 'number' and type( P2) == 'number' and type( P3) == 'number' and ( not P4 or type( P4) == 'number') then
return { P1, P2, P3, P4 or 0}
end
end
return EgtPoint3d
@@ -0,0 +1,424 @@
-- EgtVector3d.lua by EgalTech s.r.l. 2022/01/11
-- Tavola per definizione modulo (serve ma non usata)
local EgtVector3d = {}
EgtOutLog( 'EgtVector3d started', 1)
-- Include
require( 'EgtConst')
--EnableDebug( false)
-- Definizione classe Vector3d
Vector3d = {}
Vector3d.__index = Vector3d
-- funzione di utilita' per identificazione tipo
function isVector3d( a)
return ( getmetatable( a) == Vector3d)
end
local function New( x, y, z)
local v3d = setmetatable( {0,0,0}, Vector3d)
if not x then
return nil
elseif isVector3d( x) then
v3d[1] = x[1]
v3d[2] = x[2]
v3d[3] = x[3]
elseif type(x) == 'table' and #x >= 3 then
v3d[1] = x[1]
v3d[2] = x[2]
v3d[3] = x[3]
elseif type( x) == 'number' and type( y) == 'number' and type( z) == 'number' then
v3d[1] = x
v3d[2] = y
v3d[3] = z
else
error( 'A parameter is wrong', 2)
end
return v3d
end
setmetatable( Vector3d, { __call = function( _, ...) return New(...) end })
-- opposto di un vettore (unary -)
function Vector3d:__unm()
return New( - self[1], - self[2], - self[3])
end
-- somma di due vettori (+)
function Vector3d.__add( a, b)
if isVector3d( a) and isVector3d( b) then
return New( a[1] + b[1], a[2] + b[2], a[3] + b[3])
else
error( 'A parameter is not a Vector3d', 2)
end
end
-- sottrazione di due vettori (-)
function Vector3d.__sub( a, b)
if isVector3d( a) and isVector3d( b) then
return New( a[1] - b[1], a[2] - b[2], a[3] - b[3])
else
error( 'A parameter is not a Vector3d', 2)
end
end
-- moltiplicazione di un vettore per uno scalare, di uno scalare per un vettore o prodotto scalare (*)
function Vector3d.__mul( a, b)
if type( a) == 'number' then
return New( a * b[1], a * b[2], a * b[3])
elseif type( b) == 'number' then
return New( a[1] * b, a[2] * b, a[3] * b)
elseif isVector3d( a) and isVector3d( b) then
return ( a[1] * b[1] + a[2] * b[2] + a[3] * b[3])
else
error( 'A parameter is wrong', 2)
end
end
-- prodotto vettoriale (^)
function Vector3d.__pow( a, b)
if isVector3d( a) and isVector3d( b) then
return New( a[2] * b[3] - a[3] * b[2],
a[3] * b[1] - a[1] * b[3],
a[1] * b[2] - a[2] * b[1])
else
error( 'A parameter is not a Vector3d', 2)
end
end
-- divisione di un vettore per un numero (/)
function Vector3d.__div( a, b)
if isVector3d( a) and type( b) == 'number' then
return New( a[1] / b, a[2] / b, a[3] / b)
else
error( 'A parameter is wrong', 2)
end
end
-- triplo prodotto (a ^ b) * c
function Vector3d.TripleProd( a, b, c)
if isVector3d( a) and isVector3d( b) and isVector3d( c) then
return ( a[1] * ( b[2] * c[3] - b[3] * c[2]) +
a[2] * ( b[3] * c[1] - b[1] * c[3]) +
a[3] * ( b[1] * c[2] - b[2] * c[1]))
else
error( 'A parameter is wrong', 2)
end
end
-- verifica di vettore quasi nullo
function Vector3d:isSmall()
return (( self[1] * self[1] + self[2] * self[2] + self[3] * self[3]) < GEO.EPS_SMALL * GEO.EPS_SMALL)
end
-- verifica di vettore nullo
function Vector3d:isZero()
return (( self[1] * self[1] + self[2] * self[2] + self[3] * self[3]) < GEO.EPS_ZERO * GEO.EPS_ZERO)
end
-- verifica di vettore normalizzato
function Vector3d:isNormalized()
return ( math.abs( 1.0 - ( self[1] * self[1] + self[2] * self[2] + self[3] * self[3])) < 2.0 * GEO.EPS_ZERO)
end
-- calcolo quadrato della lunghezza
function Vector3d:sqlen()
return ( self[1] * self[1] + self[2] * self[2] + self[3] * self[3])
end
-- calcolo lunghezza
function Vector3d:len()
return math.sqrt( self[1] * self[1] + self[2] * self[2] + self[3] * self[3])
end
-- normalizzazione
function Vector3d:normalize()
local sqlen = self[1] * self[1] + self[2] * self[2] + self[3] * self[3]
-- verifico se già normalizzato
if math.abs( 1.0 - sqlen) < 2.0 * GEO.EPS_ZERO then
return true
end
-- verifico se normalizzabile
if sqlen < GEO.EPS_SMALL * GEO.EPS_SMALL then
return false
end
-- eseguo la normalizzazione
local len = math.sqrt( sqlen)
local denom = 1 / len
self[1] = self[1] * denom
self[2] = self[2] * denom
self[3] = self[3] * denom
return true
end
-- rotazione
function Vector3d:rotate( vtAx, dAngDeg)
if not isVector3d( self) or not isVector3d( vtAx) or not type( dAngDeg) == 'number' then
return false
end
local bOk, vRot = EgtVectorRotate( self, vtAx, dAngDeg)
if bOk then
self[1] = vRot[1]
self[2] = vRot[2]
self[3] = vRot[3]
end
return bOk
end
-- mirror
function Vector3d:mirror( vtOn)
if not isVector3d( self) or not isVector3d( vtOn) then
return false
end
local bOk, vMir = EgtVectorMirror( self, vtOn)
if bOk then
self[1] = vMir[1]
self[2] = vMir[2]
self[3] = vMir[3]
end
return bOk
end
-- trasformazione di riferimento verso globale
function Vector3d:toGlob( fTool)
if not isVector3d( self) or not isFrame3d( fTool) then
return false
end
local bOk, vNew = EgtVectorToGlob( self, fTool)
if bOk then
self[1] = vNew[1]
self[2] = vNew[2]
self[3] = vNew[3]
end
return bOk
end
-- trasformazione di riferimento verso locale
function Vector3d:toLoc( fTool)
if not isVector3d( self) or not isFrame3d( fTool) then
return false
end
local bOk, vNew = EgtVectorToLoc( self, fTool)
if bOk then
self[1] = vNew[1]
self[2] = vNew[2]
self[3] = vNew[3]
end
return bOk
end
-- trasformazione di riferimento da locale a locale
function Vector3d:locToLoc( fOri, fDest)
if not isVector3d( self) or not isFrame3d( fOri) or not isFrame3d( fDest) then
return false
end
local bOk, vNew = EgtVectorLocToLoc( self, fOri, fDest)
if bOk then
self[1] = vNew[1]
self[2] = vNew[2]
self[3] = vNew[3]
end
return bOk
end
-- restituzione componenti
function Vector3d:getX()
return self[1]
end
function Vector3d:getY()
return self[2]
end
function Vector3d:getZ()
return self[3]
end
-- assegnazione componenti
function Vector3d:setX( dX)
self[1] = dX
end
function Vector3d:setY( dY)
self[2] = dY
end
function Vector3d:setZ( dZ)
self[3] = dZ
end
-- conversione in stringa (tostring)
function Vector3d:__tostring()
return "(" .. EgtNumToString( self[1], 6) .. ", "
.. EgtNumToString( self[2], 6) .. ", "
.. EgtNumToString( self[3], 6) .. ")"
end
-- Alcune funzioni di confronto
function AreSameVectorApprox( a, b)
if isVector3d( a) and isVector3d( b) then
return ( a - b):isSmall()
else
return false
end
end
function AreSameVectorExact( a, b)
if isVector3d( a) and isVector3d( b) then
return ( a - b):isZero()
else
return false
end
end
function AreOppositeVectorApprox( a, b)
if isVector3d( a) and isVector3d( b) then
return ( a + b):isSmall()
else
return false
end
end
function AreOppositeVectorExact( a, b)
if isVector3d( a) and isVector3d( b) then
return ( a + b):isZero()
else
return false
end
end
function AreSameOrOppositeVectorApprox( a, b)
if isVector3d( a) and isVector3d( b) then
return ( a - b):isSmall() or ( a + b):isSmall()
else
return false
end
end
function AreSameOrOppositeVectorExact( a, b)
if isVector3d( a) and isVector3d( b) then
return ( a - b):isZero() or ( a + b):isZero()
else
return false
end
end
-- Creazione di vettori da coordinate sferiche e polari
function VectorFromSpherical( dLen, dAngVertDeg, dAngOrizzDeg)
local dAngVertRad = math.rad( dAngVertDeg)
local dAngOrizzRad = math.rad( dAngOrizzDeg)
local dSinAngVert = math.sin( dAngVertRad) ;
return Vector3d( dLen * dSinAngVert * math.cos( dAngOrizzRad),
dLen * dSinAngVert * math.sin( dAngOrizzRad),
dLen * math.cos( dAngVertRad)) ;
end
function VectorFromPolar( dLen, dAngDeg)
local dAngRad = math.rad( dAngDeg)
return Vector3d( dLen * math.cos( dAngRad),
dLen * math.sin( dAngRad),
0)
end
-- Creazione di vettore perpendicolare a dato e massimamente verso l'alto
function VectorFromUprightOrtho( vtV)
local vtAx = Vector3d( vtV)
if not vtAx then return nil end
-- se vettore nullo, imposto asse Z+
if vtAx:isZero() then
return Z_AX()
end
-- se vettore coincidente con asse Z, imposto asse X+
if AreSameOrOppositeVectorExact( vtAx, Z_AX()) then
return X_AX()
end
-- caso generico
vtAx:setZ( 0)
vtAx:normalize()
vtAx:rotate( Z_AX(), 90)
return ( vtV ^ vtAx)
end
-- Creazione di vettore da altro vettore con rotazione
function VectorFromRotated( vtV, vtAx, dAngDeg)
local vtRot = Vector3d( vtV)
if not vtRot then return nil end
vtRot:rotate( vtAx, dAngDeg)
return vtRot
end
-- Creazione di vettore da stringa di tre numeri
function VectorFromString( sVal)
if not sVal then
return nil
end
local vsVal = EgtSplitString( sVal)
if not vsVal then
return nil
end
if #vsVal < 3 then
return nil
end
return Vector3d( tonumber( vsVal[1]), tonumber( vsVal[2]), tonumber( vsVal[3]))
end
-- Creazione di vettore da info di entità GeomDB
function VectorFromInfo( nId, sKey)
return VectorFromString( EgtGetInfo( nId, sKey))
end
-- Coordinate sferiche da vettore
function SphericalFromVector( vtV)
if not isVector3d( vtV) then
return nil
end
local dLen = vtV:len()
-- vettore nullo
if math.abs( dLen) < GEO.EPS_ZERO then
return 0, 0, 0
end
-- vettore diretto come Z o -Z
if math.abs( vtV[1]) < GEO.EPS_ZERO and math.abs( vtV[2]) < GEO.EPS_ZERO then
if vtV[3] > 0 then
return dLen, 0, 0
else
return dLen, 180, 0
end
end
-- vettore nel piano XY
if math.abs( vtV[3]) < GEO.EPS_ZERO then
local dAngOri = math.deg( math.atan( vtV[2], vtV[1]))
if dAngOri < 0 then
dAngOri = dAngOri + 360
end
return dLen, 90, dAngOri
end
-- caso generale
local dAngVert = math.deg( math.acos( vtV[3] / dLen))
local dAngOri = math.deg( math.atan( vtV[2], vtV[1]))
if dAngOri < 0 then
dAngOri = dAngOri + 360
end
return dLen, dAngVert, dAngOri
end
-- Vettori notevoli
function V_NULL()
return Vector3d(0,0,0)
end
function X_AX()
return Vector3d(1,0,0)
end
function Y_AX()
return Vector3d(0,1,0)
end
function Z_AX()
return Vector3d(0,0,1)
end
return EgtVector3d
@@ -0,0 +1,987 @@
-- EmtGenerator.lua by EgalTech s.r.l. 2021/12/28
-- 2018/02/22 DS Funzioni bit32 sostituite con operatori sui bit.
-- 2018/08/16 DS Corretta ricorsione di SimulMoveAxis.
-- 2018/10/09 DS Controllo nDec anche in EmtLenToString.
-- 2019/03/19 DS Modificate SimulMoveAxis e SimulMoveAxes.
-- 2019/05/19 DS Aggiunta funzione SetToolForVmill.
-- 2019/08/06 DS Aggiunte funzioni AddToCollisionCheck, AddToolToCollisionCheck e DumpCollisionCheck.
-- 2020/02/04 DS Modifiche a SetToolForVmill per gestire frese con gambo piccolo.
-- 2020/02/05 DS Aggiunto parametro sCollGrp a AddToCollisionCheck e riportato nei dati successivi come Grp.
-- 2020/03/23 DS Aggiunta funzione per impostare il numero di decimali nell'emissione coordinate assi.
-- 2020/10/06 DS In AddToolToCollisionCheck ora si usano diametro e lunghezza totali, prima quelli di lavoro.
-- 2020/10/31 DS Corretta AddToCollisionCheck per riferimenti da calcolarsi in globale.
-- 2020/12/07 DS In SetToolForVmill aggiunta gestione WaterJet.
-- 2020/12/22 DS In AddToCollisionCheck per cilindri ora raggio precede altezza.
-- 2021/01/03 DS Aggiunta funzione AddToolToCollisionObj. In MoveAxis e MoveAxes aggiunta gestione delle collisioni.
-- 2021/01/19 DS In AddToolToCollisionCheck aggiunta gestione per mortasatrici/seghe a catena.
-- 2021/02/10 DS In SimulMoveAx* migliorata gestione segnalazione collisioni.
-- 2021/04/14 DS A AddToolToCollisionObj e AddToolToCollisionCheck aggiunto parametro opzionale bUseDiam.
-- 2021/05/24 DS Corretta AddToolToCollisionCheck perchè recuperava sempre l'utensile dell'uscita 1 della testa e uscita indicate.
-- Parametro bUseDiam eliminato perchè superato dalle modifiche.
-- 2021/06/25 DS In AddToolToCollisionCheck corretta gestione lame ora con lunghezza e spessore.
-- 2021/07/12 DS Migliorie a movimento asse/i per simulazione.
-- 2021/12/28 DS Anche a Centro e Punto Medio di Arco si sottrae EMT.ADDORI se definito.
-- Tavola per definizione modulo (serve ma non usata)
local EmtGenerator = {}
EgtOutLog( 'EmtGenerator started', 1)
-- Include
require( 'EgtBase')
---------------------------------------------------------------------
-- *** Output ***
---------------------------------------------------------------------
function EmtOutput( sOut, nId)
if EMT.NUM then
if not nId or nId == 1 then
EMT.LINENBR = EMT.LINENBR + EMT.LINEINC
if EMT.LINEMAX and EMT.LINENBR > EMT.LINEMAX then EMT.LINENBR = EMT.LINEINC end
EmtWrite( EMT.Nt .. EMT.LINENBR .. ' ' .. ( sOut or ''))
else
if not EMT.LINENBRS then EMT.LINENBRS = {} end
if not EMT.LINENBRS[nId] then EMT.LINENBRS[nId] = 0 end
EMT.LINENBRS[nId] = EMT.LINENBRS[nId] + EMT.LINEINC
if EMT.LINEMAX and EMT.LINENBRS[nId] > EMT.LINEMAX then EMT.LINENBRS[nId] = EMT.LINEINC end
OutFile( nId, EMT.Nt .. EMT.LINENBRS[nId] .. ' ' .. ( sOut or ''))
end
else
if not nId or nId == 1 then
EmtWrite( sOut or '')
else
OutFile( nId, sOut or '')
end
end
end
-----------------------------------------------------------------
-- *** Other Files ***
-----------------------------------------------------------------
local s_OutFh = {}
-----------------------------------------------------------------
function OpenOutFile( nId, sFile)
s_OutFh[nId] = io.open( sFile, 'w')
return s_OutFh[nId]
end
-----------------------------------------------------------------
function OutFile( nId, sOut)
if s_OutFh[nId] then
s_OutFh[nId]:write( sOut .. '\n')
end
end
-----------------------------------------------------------------
function CloseOutFile( nId)
if s_OutFh[nId] then
s_OutFh[nId]:close()
s_OutFh[nId] = nil
end
end
-----------------------------------------------------------------
-- *** Utilities ***
---------------------------------------------------------------------
function EmtUpdatePrev()
EMT.L1p = EMT.L1
EMT.L2p = EMT.L2
EMT.L3p = EMT.L3
EMT.R1p = EMT.R1
EMT.R2p = EMT.R2
EMT.R3p = EMT.R3
EMT.R4p = EMT.R4
EMT.L1op = EMT.L1o
EMT.L2op = EMT.L2o
EMT.L3op = EMT.L3o
if EMT.MOVE ~= 0 then
if EMT.F then
EMT.Fp = EMT.F
end
else
EMT.Fp = nil
end
end
function EmtResetPrevLinear()
EMT.L1p = nil
EMT.L2p = nil
EMT.L3p = nil
EMT.L1op = nil
EMT.L2op = nil
EMT.L3op = nil
end
function EmtResetPrev()
EMT.L1p = nil
EMT.L2p = nil
EMT.L3p = nil
EMT.R1p = nil
EMT.R2p = nil
EMT.R3p = nil
EMT.R4p = nil
EMT.L1op = nil
EMT.L2op = nil
EMT.L3op = nil
EMT.Fp = nil
end
function EmtSetAdditionalOrig( dAddX, dAddY, dAddZ)
EMT.ADDORI = Point3d( dAddX, dAddY, dAddZ)
end
function EmtAdjustLinearAxes()
-- salvo i valori rispetto a Zero macchina
EMT.L1o = EMT.L1
EMT.L2o = EMT.L2
EMT.L3o = EMT.L3
-- se emetto rispetto all'origine 1 della tavola
if EMT.USETO1 then
-- sottraggo agli assi lineari l'origine 1 della tavola
if EMT.L1 then
EMT.L1 = EMT.L1 - EMT.TABORI1[1]
if EMT.ADDORI then
EMT.L1 = EMT.L1 - EMT.ADDORI[1]
end
end
if EMT.L2 then
EMT.L2 = EMT.L2 - EMT.TABORI1[2]
if EMT.ADDORI then
EMT.L2 = EMT.L2 - EMT.ADDORI[2]
end
end
if EMT.L3 then
EMT.L3 = EMT.L3 - EMT.TABORI1[3]
if EMT.ADDORI then
EMT.L3 = EMT.L3 - EMT.ADDORI[3]
end
end
end
-- se emetto rispetto a piano locale
if EMT.IPLGL then
local ptP = Point3d( EMT.L1, EMT.L2, EMT.L3)
ptP:toLoc( EMT.IPLGLFR)
EMT.L1 = ptP:getX()
EMT.L2 = ptP:getY()
EMT.L3 = ptP:getZ()
end
end
function EmtAdjustRotaryAxes()
-- salvo i valori rispetto a Zero macchina
EMT.R1o = EMT.R1
EMT.R2o = EMT.R2
EMT.R3o = EMT.R3
EMT.R4o = EMT.R4
end
function EmtAdjustCenterAxes()
-- salvo i valori rispetto a Zero macchina
EMT.C1o = EMT.C1
EMT.C2o = EMT.C2
EMT.C3o = EMT.C3
-- se emetto rispetto all'origine 1 della tavola
if EMT.USETO1 then
-- sottraggo agli assi lineari l'origine 1 della tavola
if EMT.C1 then
EMT.C1 = EMT.C1 - EMT.TABORI1[1]
if EMT.ADDORI then
EMT.C1 = EMT.C1 - EMT.ADDORI[1]
end
end
if EMT.C2 then
EMT.C2 = EMT.C2 - EMT.TABORI1[2]
if EMT.ADDORI then
EMT.C2 = EMT.C2 - EMT.ADDORI[2]
end
end
if EMT.C3 then
EMT.C3 = EMT.C3 - EMT.TABORI1[3]
if EMT.ADDORI then
EMT.C3 = EMT.C3 - EMT.ADDORI[3]
end
end
end
-- se emetto rispetto a piano locale
if EMT.IPLGL then
local ptP = Point3d( EMT.C1, EMT.C2, EMT.C3)
ptP:toLoc( EMT.IPLGLFR)
EMT.C1 = ptP:getX()
EMT.C2 = ptP:getY()
EMT.C3 = ptP:getZ()
end
end
function EmtAdjustMidPointAxes()
-- salvo i valori rispetto a Zero macchina
EMT.M1o = EMT.M1
EMT.M2o = EMT.M2
EMT.M3o = EMT.M3
-- se emetto rispetto all'origine 1 della tavola
if EMT.USETO1 then
-- sottraggo agli assi lineari l'origine 1 della tavola
if EMT.M1 then
EMT.M1 = EMT.M1 - EMT.TABORI1[1]
if EMT.ADDORI then
EMT.M1 = EMT.M1 - EMT.ADDORI[1]
end
end
if EMT.M2 then
EMT.M2 = EMT.M2 - EMT.TABORI1[2]
if EMT.ADDORI then
EMT.M2 = EMT.M2 - EMT.ADDORI[2]
end
end
if EMT.M3 then
EMT.M3 = EMT.M3 - EMT.TABORI1[3]
if EMT.ADDORI then
EMT.M3 = EMT.M3 - EMT.ADDORI[3]
end
end
end
-- se emetto rispetto a piano locale
if EMT.IPLGL then
local ptP = Point3d( EMT.M1, EMT.M2, EMT.M3)
ptP:toLoc( EMT.IPLGLFR)
EMT.M1 = ptP:getX()
EMT.M2 = ptP:getY()
EMT.M3 = ptP:getZ()
end
end
local function EmtToEmit( V, Vp)
if not V then
return false
end
if not EMT.MODAL or not Vp then
return true
end
return ( abs( V - Vp) > 0.001)
end
function EmtGetAxis( Ax, bRotLikeLin)
local Axp = Ax .. 'p'
local Axt = Ax .. 't'
if EMT[Axt] and EmtToEmit( EMT[Ax], EMT[Axp]) then
local nDec = EMT.DECNUM or 3
if not EMT.INCHES or (( Ax == 'R1' or Ax == 'R2' or Ax == 'R3' or Ax == 'R4') and not bRotLikeLin) then
return ' ' .. EMT[Axt] .. EgtNumToString( EMT[Ax], nDec), true
else
return ' ' .. EMT[Axt] .. EgtNumToString( EMT[Ax] / GEO.ONE_INCH, nDec + 1), true
end
end
return '', false
end
function EmtGetRapidAxis( Ax, bRotLikeLin)
local MaskVal = {L1=1,L2=2,L3=4,R1=8,R2=16,R3=32,R4=64} -- per lua 5.2 {L1=0,L2=1,L3=2,R1=3,R2=4,R3=5,R4=6}
if ( EMT.MASK & MaskVal[Ax]) ~= 0 then -- per lua 5.2 bit32.extract(EMT.MASK,MaskVal[Ax]) ~= 0
return EmtGetAxis( Ax, bRotLikeLin)
end
-- mascherato, sistemo attuale come precedente
local Axp = Ax .. 'p'
local Axt = Ax .. 't'
EMT[Ax] = EMT[Axp]
return '', false
end
function EmtGetHomeAxis( Ax, bRotLikeLin)
local MaskVal = {L1=1,L2=2,L3=4,R1=8,R2=16,R3=32,R4=64} -- per lua 5.2 {L1=0,L2=1,L3=2,R1=3,R2=4,R3=5,R4=6}
if ( EMT.MASK & MaskVal[Ax]) ~= 0 then -- per lua 5.2 bit32.extract(EMT.MASK,MaskVal[Ax]) ~= 0
local Axo = Ax .. 'o'
local Axt = Ax .. 't'
if EMT[Axt] then
local nDec = EMT.DECNUM or 3
if not EMT.INCHES or (( Ax == 'R1' or Ax == 'R2' or Ax == 'R3' or Ax == 'R4') and not bRotLikeLin) then
return ' ' .. EMT[Axt] .. EgtNumToString( EMT[Axo], nDec), true
else
return ' ' .. EMT[Axt] .. EgtNumToString( EMT[Axo] / GEO.ONE_INCH, nDec + 1), true
end
end
end
return '', false
end
function EmtGetHomeAxisByName( Ax, dOffset, bRotLikeLin)
local sToken = EgtGetAxisToken( Ax)
local bLinear = EgtGetAxisType( Ax)
local dVal = EgtGetAxisHomePos( Ax)
if dOffset then
dVal = dVal + dOffset
end
if sToken and bLinear ~= nil and dVal then
local nDec = EMT.DECNUM or 3
if not EMT.INCHES or ( not bLinear and not bRotLikeLin) then
return ' ' .. sToken .. EgtNumToString( dVal, nDec), true
else
return ' ' .. sToken .. EgtNumToString( dVal / GEO.ONE_INCH, nDec + 1), true
end
else
return '', false
end
end
function EmtGetFeed()
if EmtToEmit( EMT.F, EMT.Fp) then
if not EMT.INCHES then
return ' ' .. EMT.Ft .. EgtNumToString( EMT.F, 0)
else
return ' ' .. EMT.Ft .. EgtNumToString( EMT.F / GEO.ONE_INCH, 1)
end
end
return ''
end
function EmtGetArcType( nMove, bInv)
if nMove == 2 then
if bInv then
return 3
else
return 2
end
elseif nMove == 3 then
if bInv then
return 2
else
return 3
end
else
return nil
end
end
-------------------------------------------------------------------------------
function EmtGetAngO2( vtZ, vtX, dAngV, dAngO)
-- vettore X di riferimento
local vtRif = Vector3d( X_AX())
-- lo ruoto prima attorno a Y poi attorno a Z
vtRif:rotate( Y_AX(), dAngV)
vtRif:rotate( Z_AX(), dAngO)
-- prodotto scalare tra vettore riferimento ruotato e vettore vtX
local dCos = vtRif * vtX
-- prodotto scalare tra vettore prodotto vettoriale dei due e vettore vtZ
local dSin = ( vtRif ^ vtX) * vtZ
-- restituisco l'angolo di rotazione richiesto
return atan2( dSin, dCos)
end
-------------------------------------------------------------------------------
function EmtGetAngO3( vtZ, vtX, dAngV, dAngO)
-- vettore X di riferimento
local vtRif = Vector3d( X_AX())
-- vettore asse di rotazione
local vtAx = Vector3d( - sin( dAngO), cos( dAngO), 0)
-- ruoto X di rif attorno a questo asse
vtRif:rotate( vtAx, dAngV)
-- prodotto scalare tra vettore riferimento ruotato e vettore vtX
local dCos = vtRif * vtX
-- prodotto scalare tra vettore prodotto vettoriale dei due e vettore vtZ
local dSin = ( vtRif ^ vtX) * vtZ
-- restituisco l'angolo di rotazione richiesto
return atan2( dSin, dCos)
end
-------------------------------------------------------------------------------
function EmtLenToString( Val, nDec)
nDec = ( nDec or 3)
if not EMT.INCHES then
return EgtNumToString( Val, nDec)
else
return EgtNumToString( Val/GEO.ONE_INCH, nDec + 1)
end
end
-------------------------------------------------------------------------------
function EmtNum3ToString( Tav, nDec)
nDec = ( nDec or 3)
return EgtNumToString( Tav[1], nDec) .. ","..
EgtNumToString( Tav[2], nDec) .. ","..
EgtNumToString( Tav[3], nDec)
end
-------------------------------------------------------------------------------
function EmtLen3ToString( Tav, nDec)
nDec = ( nDec or 3)
return EmtLenToString( Tav[1], nDec) .. ","..
EmtLenToString( Tav[2], nDec) .. ","..
EmtLenToString( Tav[3], nDec)
end
---------------------------------------------------------------------
function EmtSecToHMS( dSec)
local nH = floor( dSec / 3600)
local nM = floor(( dSec - nH * 3600) / 60)
local nS = floor( dSec - nH * 3600 - nM * 60)
local sH = EgtIf( nH < 10, '0', '') .. tostring( nH)
local sM = EgtIf( nM < 10, '0', '') .. tostring( nM)
local sS = EgtIf( nS < 10, '0', '') .. tostring( nS)
return sH .. ':' .. sM .. ':' .. sS
end
---------------------------------------------------------------------
function EmtLenToMF( dLen)
local dOut
if EMT.INCHES then
dOut = dLen / 304.8
else
dOut = dLen / 1000
end
return EgtIf( dOut < 10, ' ', '') .. EgtNumToString( dOut, -1)
end
---------------------------------------------------------------------
-- *** Estimation functions ***
---------------------------------------------------------------------
local s_TleTitle
local s_TleMach = {}
local s_TleTool = {}
---------------------------------------------------------------------
function EmtTleStart( sTitle)
-- inizializzazioni
s_TleTitle = sTitle
s_TleMach = {}
s_TleTool = {}
end
---------------------------------------------------------------------
function EmtTleAddMachining( sName, sTime, sLen, sTool)
table.insert( s_TleMach, { Name = sName, Time = sTime, Len = sLen, Tool = sTool})
end
---------------------------------------------------------------------
function EmtTleAddTotal( sTotTime, sTotLen)
s_TleMach.Total = { Time = sTotTime, Len = sTotLen}
end
---------------------------------------------------------------------
function EmtTleAddTool( sName, sLen)
table.insert( s_TleTool, { Name = sName, Len = sLen})
end
---------------------------------------------------------------------
function EmtTleEnd( sFormat)
-- se richiesto formato HTML
if sFormat:lower() == 'html' then
-- intestazione
EmtOutput( '<!DOCTYPE html>')
EmtOutput( '<html>')
EmtOutput( '<head>')
EmtOutput( ' <meta http-equiv="X-UA-Compatible" content="IE=10; charset=utf-8"/>')
EmtOutput( ' <title>' .. ( s_TleTitle or '') .. '</title>')
EmtOutput( ' <style type = "text/css">\r\n' ..
' caption {\r\n' ..
' margin: 10px;\r\n' ..
' font: 200% arial, sans-serif;\r\n' ..
' }\r\n' ..
' table, th, td {\r\n' ..
' border: 1px solid black;\r\n' ..
' border-collapse: collapse;\r\n' ..
' }\r\n' ..
' table {\r\n' ..
' margin: 30px;\r\n' ..
' background-color: #f2f2f2;\r\n' ..
' }\r\n' ..
' th, td {\r\n' ..
' padding: 0.4rem;\r\n' ..
' text-align: center;\r\n' ..
' }\r\n' ..
' tr.total {\r\n' ..
' background-color: #e6e6e6;\r\n' ..
' }\r\n' ..
' </style>')
EmtOutput( '</head>')
EmtOutput( '<body>')
-- tabella lavorazioni
if s_TleMach and #s_TleMach > 0 then
EmtOutput( ' <table>\r\n' ..
' <caption>Machinings</caption>\r\n' ..
' <tr>\r\n' ..
' <th></th>\r\n' ..
' <th>Time [h:m:s]</th>\r\n' ..
' <th>Len ' .. EgtIf( EMT.INCHES, '[ft]', '[m]') .. '</th>\r\n' ..
' <th>Tool</th>\r\n' ..
' </tr>')
for i = 1, #s_TleMach do
EmtOutput( ' <tr>\r\n' ..
' <td>' .. ( s_TleMach[i].Name or '') .. '</td>\r\n' ..
' <td>' .. ( s_TleMach[i].Time or '') .. '</td>\r\n' ..
' <td>' .. ( s_TleMach[i].Len or '') .. '</td>\r\n' ..
' <td>' .. ( s_TleMach[i].Tool or '') .. '</td>\r\n' ..
' </tr>')
end
EmtOutput( ' <tr class="total">\r\n' ..
' <td>TOTAL</td>\r\n' ..
' <td>' .. ( s_TleMach.Total.Time or '') .. '</td>\r\n' ..
' <td>' .. ( s_TleMach.Total.Len or '') .. '</td>\r\n' ..
' <td>' .. '</td>\r\n' ..
' </tr>')
EmtOutput( ' </table>')
end
-- tabella utensili
if s_TleTool and #s_TleTool > 0 then
EmtOutput( ' <table>\r\n' ..
' <caption>Tools</caption>\r\n' ..
' <tr>\r\n' ..
' <th></th>\r\n' ..
' <th>Len ' .. EgtIf( EMT.INCHES, '[ft]', '[m]') .. '</th>\r\n' ..
' </tr>')
for i = 1, #s_TleTool do
EmtOutput( ' <tr>\r\n' ..
' <td>' .. ( s_TleTool[i].Name or '') .. '</td>\r\n' ..
' <td>' .. ( s_TleTool[i].Len or '') .. '</td>\r\n' ..
' </tr>')
end
EmtOutput( ' </table>')
end
-- conclusione
EmtOutput( '</body>')
EmtOutput( '</html>')
-- altrimenti formato testo
else
-- intestazione
EmtOutput( ' ' .. ( s_TleTitle or '') .. '\r\n \r\n')
-- tabella lavorazioni
if s_TleMach and #s_TleMach > 0 then
EmtOutput( ' Machinings')
EmtOutput( ' ==========')
EmtOutput( ' Time [h:m:s] Len ' .. EgtIf( EMT.INCHES, '[ft]', '[m]') .. ' Tool')
for i = 1, #s_TleMach do
local sName = ( s_TleMach[i].Name or '')
sName = sName .. string.rep( ' ', 18 - #sName)
EmtOutput( sName .. ( s_TleMach[i].Time or '') .. ' ' .. ( s_TleMach[i].Len or '') .. ' ' .. ( s_TleMach[i].Tool or ''))
end
end
EmtOutput( '-------------------------------------------------------')
EmtOutput( 'TOTAL ' .. ( s_TleMach.Total.Time or '') .. ' ' .. ( s_TleMach.Total.Len or ''))
-- tabella utensili
if s_TleTool and #s_TleTool > 0 then
EmtOutput( '\r\n\r\n Tools')
EmtOutput( ' =====')
EmtOutput( ' Len ' .. EgtIf( EMT.INCHES, '[ft]', '[m]'))
for i = 1, #s_TleTool do
local sName = ( s_TleTool[i].Name or '')
sName = sName .. string.rep( ' ', 19 - #sName)
EmtOutput( sName .. ( s_TleTool[i].Len or ''))
end
end
end
end
---------------------------------------------------------------------
-- *** Simulation functions ***
---------------------------------------------------------------------
local function MyPrepareAxis( sName, dPos, dStep, nS)
if not sName then return nil, nS end
local dPrev = EgtGetAxisPos( sName)
if not dPrev then return nil, nS end
if abs( dStep) > GEO.EPS_SMALL then
local nSa = abs( ceil( ( dPos - dPrev) / dStep))
nS = max( nS, nSa)
end
return dPrev, nS
end
---------------------------------------------------------------------
local function MySetAxisPos( sName, dPos)
local bOk, dNewPos = EgtSetAxisPos( sName, dPos)
return ( bOk and abs( dNewPos - dPos) < 10 * GEO.EPS_SMALL)
end
---------------------------------------------------------------------
function SimulMoveAxis( sName, dPos, dStep)
-- salvo step attuale
EMT.SIMSTEP = EMT.SIMSTEP or 20
local dSimStep = EMT.SIMSTEP
-- preparazione asse
local dPrev, nS = MyPrepareAxis( sName, dPos, dStep, 1)
-- l'asse deve essere ben definito
if not dPrev then return false end
-- movimento
if nS > 0 then
for i = 1, nS do
local dCoeff = i / nS
local bOk = MySetAxisPos( sName, ( 1 - dCoeff) * dPrev + dCoeff * dPos)
EgtDraw()
local bCheckOk, nCdInd, nObjInd = EmtExecCollisionCheck()
if not bCheckOk then
local nPrevErr = EMT.ERR
local bCollOk, nErr = EmtOnCollision( nCdInd, nObjInd)
if not bCollOk and nErr == 11 then
if EgtGetEnableUI() then
EgtOutBox( 'Collisione!', 'AVVERTIMENTO', 'WARNING')
EMT.SIMUISTAT = MCH_UISIM.PAUSE
while EMT.SIMUISTAT == MCH_UISIM.PAUSE do
-- Param1 = -11 notifica al simulatore pausa per collisione
EgtProcessEvents( -11, 4)
end
end
else
EMT.ERR = nPrevErr
end
end
if not bOk then
return false
end
if EgtGetEnableUI() then
EgtProcessEvents( 0, 4)
while EMT.SIMUISTAT == MCH_UISIM.PAUSE do
EgtProcessEvents( 0, 4)
end
if EMT.SIMUISTAT == MCH_UISIM.STOP then
error( 'STOP')
end
-- se cambia lo step di simulazione richiesto in modo significativo ...
if abs( EMT.SIMSTEP - dSimStep) > 5 then
local dC = EMT.SIMSTEP / dSimStep
return SimulMoveAxis( sName, dPos, dC * dStep)
end
end
end
end
-- assegno valore finale esatto
return MySetAxisPos( sName, dPos)
end
---------------------------------------------------------------------
function SimulMoveAxes( sName, dPos, dStep, sName2, dPos2, dStep2, sName3, dPos3, dStep3, sName4, dPos4, dStep4, sName5, dPos5, dStep5)
-- salvo step attuale
EMT.SIMSTEP = EMT.SIMSTEP or 20
local dSimStep = EMT.SIMSTEP
-- preparazione dei diversi assi
local dPrev, dPrev2, dPrev3, dPrev4, dPrev5
local nS = 1
dPrev, nS = MyPrepareAxis( sName, dPos, dStep, nS)
dPrev2, nS = MyPrepareAxis( sName2, dPos2, dStep2, nS)
dPrev3, nS = MyPrepareAxis( sName3, dPos3, dStep3, nS)
dPrev4, nS = MyPrepareAxis( sName4, dPos4, dStep4, nS)
dPrev5, nS = MyPrepareAxis( sName5, dPos5, dStep5, nS)
-- il primo asse deve essere ben definito
if not dPrev then return false end
-- movimento
if nS > 0 then
for i = 1, nS do
local dCoeff = i / nS
local bOk = MySetAxisPos( sName, ( 1 - dCoeff) * dPrev + dCoeff * dPos)
local bOk2 = not dPrev2 or MySetAxisPos( sName2, ( 1 - dCoeff) * dPrev2 + dCoeff * dPos2)
local bOk3 = not dPrev3 or MySetAxisPos( sName3, ( 1 - dCoeff) * dPrev3 + dCoeff * dPos3)
local bOk4 = not dPrev4 or MySetAxisPos( sName4, ( 1 - dCoeff) * dPrev4 + dCoeff * dPos4)
local bOk5 = not dPrev5 or MySetAxisPos( sName5, ( 1 - dCoeff) * dPrev5 + dCoeff * dPos5)
EgtDraw()
local bCheckOk, nCdInd, nObjInd = EmtExecCollisionCheck()
if not bCheckOk then
local nPrevErr = EMT.ERR
local bCollOk, nErr = EmtOnCollision( nCdInd, nObjInd)
if not bCollOk and nErr == 11 then
EMT.ERR = 11
if EgtGetEnableUI() then
EgtOutBox( 'Collisione!', 'AVVERTIMENTO', 'WARNING')
EMT.SIMUISTAT = MCH_UISIM.PAUSE
while EMT.SIMUISTAT == MCH_UISIM.PAUSE do
-- Param1 = -11 notifica al simulatore pausa per collisione
EgtProcessEvents( -11, 4)
end
end
else
EMT.ERR = nPrevErr
end
end
if not ( bOk and bOk2 and bOk3 and bOk4 and bOk5) then
return false, bOk, bOk2, bOk3, bOk4, bOk5
end
if EgtGetEnableUI() then
EgtProcessEvents( 0, 4)
while EMT.SIMUISTAT == MCH_UISIM.PAUSE do
EgtProcessEvents( 0, 4)
end
if EMT.SIMUISTAT == MCH_UISIM.STOP then
error( 'STOP')
end
-- se cambia lo step di simulazione richiesto in modo significativo ...
if abs( EMT.SIMSTEP - dSimStep) > 5 then
local dC = EMT.SIMSTEP / dSimStep
return SimulMoveAxes( sName, dPos, dC * dStep,
sName2, dPos2, dC * ( dStep2 or 0), sName3, dPos3, dC * ( dStep3 or 0),
sName4, dPos4, dC * ( dStep4 or 0), sName5, dPos5, dC * ( dStep5 or 0))
end
end
end
end
-- assegno valore finale esatto
local bOk = MySetAxisPos( sName, dPos)
local bOk2 = not dPrev2 or MySetAxisPos( sName2, dPos2)
local bOk3 = not dPrev3 or MySetAxisPos( sName3, dPos3)
local bOk4 = not dPrev4 or MySetAxisPos( sName4, dPos4)
local bOk5 = not dPrev5 or MySetAxisPos( sName5, dPos5)
return ( bOk and bOk2 and bOk3 and bOk4 and bOk5), bOk, bOk2, bOk3, bOk4, bOk5
end
---------------------------------------------------------------------
function SetToolForVmill( sTool, sHead, nExit, VMill)
-- se Vmill non definito, esco
if not VMill then return true end
-- se utensile, testa o uscita non definiti, reset ed esco
if not sTool or sTool == '' or not sHead or sHead == '' or not nExit then
EgtVolZmapResetTool( VMill)
return false
end
-- verifico che l'utensile sia corrente
local sOldTool = EgtTdbGetCurrToolParam( MCH_TP.NAME)
if sTool ~= sOldTool then
if not EgtTdbSetCurrTool( sTool) then return false end
end
-- dichiaro utensile per Vmill
local nType = EgtTdbGetCurrToolParam( MCH_TP.TYPE)
local dLen = EgtTdbGetCurrToolParam( MCH_TP.LEN)
local dDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local dThick = EgtTdbGetCurrToolParam( MCH_TP.THICK)
local dCornR = EgtTdbGetCurrToolParam( MCH_TP.CORNRAD)
local dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG)
local dMaxMat = EgtTdbGetCurrToolParam( MCH_TP.MAXMAT)
-- ricerca dell'outline e del diametro gambo
local nExitId = EgtGetFirstNameInGroup( EgtGetHeadId( sHead) or GDB_ID.NULL, 'T' .. tostring( nExit))
local nToolId = EgtGetFirstNameInGroup( nExitId or GDB_ID.NULL, sTool)
local nOutlineId = EgtGetFirstNameInGroup( nToolId or GDB_ID.NULL, 'Outline')
local dMaxStemDiam = EgtGetInfo( nToolId or GDB_ID.NULL, 'D_STEM', 'd') or dDiam
-- imposto profilo utensile per Vmill
if nOutlineId then
EgtVolZmapSetGenTool( VMill, sTool, nOutlineId)
elseif nType == MCH_TY.MORTISE_STD then
EgtVolZmapSetMortiserTool( VMill, sTool, dLen, dDiam, dThick, dCornR)
elseif nType == MCH_TY.SAW_STD or nType == MCH_TY.SAW_FLAT then
EgtVolZmapSetSawTool( VMill, sTool, dLen, dDiam, dThick, 0, dCornR)
elseif nType == MCH_TY.WATERJET then
EgtVolZmapSetStdTool( VMill, sTool, dLen + 50, dDiam, dCornR, dMaxMat)
elseif abs( dSideAng) < GEO.EPS_ANG_SMALL or abs( dThick) < GEO.EPS_ANG_SMALL then
if dDiam <= dMaxStemDiam then
EgtVolZmapSetStdTool( VMill, sTool, dLen, dDiam, dCornR, dMaxMat)
else
EgtVolZmapSetSawTool( VMill, sTool, dLen, dDiam, dMaxMat, 0, dCornR)
end
else
local bExtra = ( dThick > 0)
local dTipLen = abs( dThick)
local dTotLen = EgtIf( bExtra, dLen + dTipLen, dLen)
local dDelta
if dSideAng > 0 then
if dCornR < GEO.EPS_SMALL then
dDelta = 2 * dTipLen * tan( dSideAng)
else
dDelta = 2 * ( dCornR * cos( dSideAng) + ( dTipLen - dCornR + dCornR * sin( dSideAng)) * tan( dSideAng))
end
else
dDelta = 2 * tan( dSideAng) * dTipLen
end
local dStemDiam = EgtIf( bExtra, dDiam, dDiam + dDelta)
local dTipDiam = EgtIf( bExtra, dDiam - dDelta, dDiam)
EgtVolZmapSetAdvTool( VMill, sTool, dTotLen, dStemDiam, dTipLen, dTipDiam, dCornR, dMaxMat)
end
-- se l'utensile non era corrente, ripristino il precedente
if sTool ~= sOldTool then
EgtTdbSetCurrTool( sOldTool)
end
return true
end
---------------------------------------------------------------------
local function AddGeomToCollisionCheck( CollGrpId, sClass, vColl)
if not CollGrpId then return false end
local sCollGrp = EgtGetName( CollGrpId) or ''
-- ricerca dei box
local BoxId = EgtGetFirstNameInGroup( CollGrpId, 'BOX')
while BoxId do
local FrameId = BoxId + ( EgtGetInfo( BoxId, 'Frame', 'i') or 0)
if FrameId ~= BoxId and EgtGetType( FrameId) == GDB_TY.GEO_FRAME then
local b3Box = EgtGetBBoxRef( BoxId, GDB_BB.STANDARD, EgtFR( FrameId, GDB_ID.ROOT))
local vtDiag = b3Box:getMax() - b3Box:getMin()
local vtM = b3Box:getMin() - ORIG()
table.insert( vColl, { Cl=sClass, Grp=sCollGrp, Fr=FrameId, Ty=MCH_SIM_COB.BOX, Mv=vtM, P1=vtDiag:getX(), P2=vtDiag:getY(), P3=vtDiag:getZ()})
BoxId = EgtGetNextName( BoxId, 'BOX')
end
end
-- ricerca dei cilindri
local CylId = EgtGetFirstNameInGroup( CollGrpId, 'CYL')
while CylId do
local FrameId = CylId + ( EgtGetInfo( CylId, 'Frame', 'i') or 0)
if FrameId ~= CylId and EgtGetType( FrameId) == GDB_TY.GEO_FRAME then
local b3Box = EgtGetBBoxRef( CylId, GDB_BB.STANDARD, EgtFR( FrameId, GDB_ID.ROOT))
local dR = ( b3Box:getDimX() + b3Box:getDimY()) / 4
local dH = b3Box:getDimZ()
local vtM = Vector3d( 0, 0, b3Box:getMin():getZ())
table.insert( vColl, { Cl=sClass, Grp=sCollGrp, Fr=FrameId, Ty=MCH_SIM_COB.CYL, Mv=vtM, P1=dR, P2=dH, P3=0})
CylId = EgtGetNextName( CylId, 'CYL')
end
end
-- ricerca delle sfere
local SphId = EgtGetFirstNameInGroup( CollGrpId, 'SPH')
while SphId do
local FrameId = SphId + ( EgtGetInfo( SphId, 'Frame', 'i') or 0)
if FrameId ~= SphId and EgtGetType( FrameId) == GDB_TY.GEO_FRAME then
local b3Box = EgtGetBBoxRef( SphId, GDB_BB.STANDARD, EgtFR( FrameId, GDB_ID.ROOT))
local dR = ( b3Box:getDimX() + b3Box:getDimY() + b3Box:getDimZ()) / 6
local vtM = b3Box:getCenter() - ORIG()
table.insert( vColl, { Cl=sClass, Grp=sCollGrp, Fr=FrameId, Ty=MCH_SIM_COB.SPHE, Mv=vtM, P1=dR, P2=0, P3=0})
SphId = EgtGetNextName( SphId, 'SPH')
end
end
-- ricerca dei tronchi di cono
local ConId = EgtGetFirstNameInGroup( CollGrpId, 'CON')
while ConId do
local FrameId = ConId + ( EgtGetInfo( ConId, 'Frame', 'i') or 0)
if FrameId ~= ConId and EgtGetType( FrameId) == GDB_TY.GEO_FRAME then
local frRef = EgtFR( FrameId, GDB_ID.ROOT)
local vtZ = frRef:getVersZ()
local dRb, dRt, dOb, dOt
-- ricerca delle facce bottom e top
local nFacCnt = EgtSurfTmFacetCount( ConId)
for i = 0, nFacCnt - 1 do
local vtN = EgtSurfTmFacetNormVersor( ConId, i, GDB_ID.ROOT)
if AreSameVectorApprox( vtN, vtZ) then
local b3Box = EgtSurfTmGetFacetBBoxRef( ConId, i, GDB_BB.STANDARD, frRef)
dRt = ( b3Box:getDimX() + b3Box:getDimY()) / 4
dOt = b3Box:getCenter():getZ()
elseif AreOppositeVectorApprox( vtN, vtZ) then
local b3Box = EgtSurfTmGetFacetBBoxRef( ConId, i, GDB_BB.STANDARD, frRef)
dRb = ( b3Box:getDimX() + b3Box:getDimY()) / 4
dOb = b3Box:getCenter():getZ()
end
end
if dRb and dRt and dOb and dOt then
local vtM = Vector3d( 0, 0, dOb)
local dH = dOt - dOb
table.insert( vColl, { Cl=sClass, Grp=sCollGrp, Fr=FrameId, Ty=MCH_SIM_COB.CONE, Mv=vtM, P1=dRb, P2=dRt, P3=dH})
end
ConId = EgtGetNextName( ConId, 'CON')
end
end
return true
end
---------------------------------------------------------------------
function AddToCollisionCheck( sName, sCollGrp, vColl)
if not vColl then return false end
-- ricerca del gruppo base
local GroupId = EgtGetHeadId( sName)
if not GroupId then GroupId = EgtGetAxisId( sName) end
if not GroupId then GroupId = EgtGetTableId( sName) end
if not GroupId then GroupId = EgtGetBaseId( sName) end
if not GroupId then return false end
-- ricerca del gruppo di collisione
local CAxCollId = EgtGetFirstNameInGroup( GroupId, sCollGrp)
if not CAxCollId then return false end
-- recupero della geometria di collisione
return AddGeomToCollisionCheck( CAxCollId, sName, vColl)
end
---------------------------------------------------------------------
function AddToolToCollisionCheck( sHeadName, nExit, vColl)
if not vColl then return false end
local sTool = EgtGetLoadedTool( sHeadName, nExit)
if not EgtTdbSetCurrTool( sTool or '') then return false end
local nType = EgtTdbGetCurrToolParam( MCH_TP.TYPE)
local dTotRad = EgtTdbGetCurrToolParam( MCH_TP.TOTDIAM) / 2
local dTotLen = EgtTdbGetCurrToolParam( MCH_TP.TOTLEN)
local HeadId = EgtGetHeadId( sHeadName)
local FrameId = EgtGetFirstNameInGroup( HeadId, '_T'..tostring( nExit))
if nType == MCH_TY.SAW_STD or nType == MCH_TY.SAW_FLAT then
local vtM = Vector3d( 0, 0, -dTotLen)
local dThick = EgtTdbGetCurrToolParam( MCH_TP.THICK)
table.insert( vColl, { Cl='T_'..sHeadName, Grp=sTool, Fr=FrameId, Ty=MCH_SIM_COB.CYL, Mv=vtM, P1=dTotRad, P2=dThick, P3=0})
elseif nType == MCH_TY.DRILL_STD or nType == MCH_TY.DRILL_LONG then
local dLen = EgtTdbGetCurrToolParam( MCH_TP.LEN)
local vtMc = Vector3d( 0, 0, -dLen)
table.insert( vColl, { Cl='T_'..sHeadName, Grp=sTool, Fr=FrameId, Ty=MCH_SIM_COB.CYL, Mv=vtMc, P1=dTotRad, P2=dLen, P3=0})
if dTotLen > dLen + 0.1 then
local vtMt = Vector3d( 0, 0, -dTotLen)
table.insert( vColl, { Cl='T_'..sHeadName, Grp=sTool, Fr=FrameId, Ty=MCH_SIM_COB.CONE, Mv=vtMt, P1=0, P2=dTotRad, P3=dTotLen-dLen})
end
elseif nType ~= MCH_TY.MORTISE_STD then
local dSideAng = EgtTdbGetCurrToolParam( MCH_TP.SIDEANG)
local dThick = EgtTdbGetCurrToolParam( MCH_TP.THICK)
if abs( dSideAng) < GEO.EPS_ANG_SMALL or abs( dThick) < GEO.EPS_ANG_SMALL then
local vtM = Vector3d( 0, 0, -dTotLen)
table.insert( vColl, { Cl='T_'..sHeadName, Grp=sTool, Fr=FrameId, Ty=MCH_SIM_COB.CYL, Mv=vtM, P1=dTotRad, P2=dTotLen, P3=0})
else
local dLen = EgtTdbGetCurrToolParam( MCH_TP.LEN)
local dDiam = EgtTdbGetCurrToolParam( MCH_TP.DIAM)
local bExtra = ( dThick > 0)
local dTipLen = abs( dThick)
local dTotLen = EgtIf( bExtra, dLen + dTipLen, dLen)
local dDelta = 2 * dTipLen * tan( dSideAng)
local dStemRad = EgtIf( bExtra, dDiam, dDiam + dDelta) / 2
local dTipRad = EgtIf( bExtra, dDiam - dDelta, dDiam) / 2
local vtMs = Vector3d( 0, 0, -( dTotLen - dTipLen))
table.insert( vColl, { Cl='T_'..sHeadName, Grp=sTool, Fr=FrameId, Ty=MCH_SIM_COB.CYL, Mv=vtMs, P1=dStemRad, P2=dTotLen-dTipLen, P3=0})
local vtMt = Vector3d( 0, 0, -dTotLen)
table.insert( vColl, { Cl='T_'..sHeadName, Grp=sTool, Fr=FrameId, Ty=MCH_SIM_COB.CONE, Mv=vtMt, P1=dTipRad, P2=dStemRad, P3=dTipLen})
end
else
EgtErase( EgtGetFirstNameInGroup( HeadId, '_TT'..tostring( nExit)) or GDB_ID.NULL)
local frRef = EgtFR( FrameId)
local SpecFrId = EgtCopy( FrameId, FrameId, GDB_IN.AFTER)
EgtSetName( SpecFrId, '_TT'..tostring( nExit))
EgtRotate( SpecFrId, frRef:getOrigin(), frRef:getVersY(), 90)
local dThick = EgtTdbGetCurrToolParam( MCH_TP.THICK)
local vtMb = Vector3d( 0, -dTotRad, 0)
table.insert( vColl, { Cl='T_'..sHeadName, Grp=sTool, Fr=SpecFrId, Ty=MCH_SIM_COB.BOX, Mv=vtMb, P1=dTotLen-dTotRad, P2=2*dTotRad, P3=dThick})
local vtMc = Vector3d( dTotLen-dTotRad, 0, 0)
table.insert( vColl, { Cl='T_'..sHeadName, Grp=sTool, Fr=SpecFrId, Ty=MCH_SIM_COB.CYL, Mv=vtMc, P1=dTotRad, P2=dThick, P3=0})
end
return true
end
---------------------------------------------------------------------
function DumpCollisionCheck( vColl, sTitle, nDbgLev)
if not vColl then return false end
if EgtGetDebugLevel() < ( nDbgLev or 1) then return true end
if sTitle then EgtOutLog( sTitle, nDbgLev or 1) end
for i, Coll in ipairs( vColl) do
local sOut = ' Class='..Coll.Cl..' Group='..Coll.Grp..' FrId='..tostring( Coll.Fr)..' Type='..tostring( Coll.Ty)..' Mv='..tostring( Coll.Mv)
if Coll.Ty == MCH_SIM_COB.BOX then
sOut = sOut .. ' L='..EgtNumToString( Coll.P1, 3)..' W='..EgtNumToString( Coll.P2, 3)..' H='..EgtNumToString( Coll.P3, 3)
elseif Coll.Ty == MCH_SIM_COB.CYL then
sOut = sOut .. ' R='..EgtNumToString( Coll.P1, 3)..' H='..EgtNumToString( Coll.P2, 3)
elseif Coll.Ty == MCH_SIM_COB.SPHE then
sOut = sOut .. ' R='..EgtNumToString( Coll.P1, 3)
elseif Coll.Ty == MCH_SIM_COB.CONE then
sOut = sOut .. ' Rb='..EgtNumToString( Coll.P1, 3)..' Rt='..EgtNumToString( Coll.P2, 3)..' H='..EgtNumToString( Coll.P3, 3)
end
EgtOutLog( sOut, nDbgLev or 1)
end
return true
end
---------------------------------------------------------------------
function AddToolToCollisionObj( sTool, sHeadName, nExit, nInd)
local vToolColl = {}
AddToolToCollisionCheck( sHeadName, nExit, vToolColl)
if #vToolColl == 0 then return false end
DumpCollisionCheck( vToolColl, 'Tool Collision Objects :', 4)
-- aggiungo la geometria trovata
for i = 1, #vToolColl do
EmtAddCollisionObjEx( nInd, vToolColl[i].Fr, vToolColl[i].Ty, vToolColl[i].Mv, vToolColl[i].P1, vToolColl[i].P2, vToolColl[i].P3)
end
return true, vToolColl[1]
end
---------------------------------------------------------------------
function AddToolHolderToCollisionObj( sTool, sHeadName, nExit, nInd)
-- recupero il gruppo dell'utensile
local HeadId = EgtGetHeadId( sHeadName)
local ExitId = EgtGetFirstNameInGroup( HeadId, 'T'..tostring( nExit))
local ToolId = EgtGetFirstInGroup( ExitId)
-- cerco la geometria di collisione in questo gruppo
local vThColl = {}
if not AddGeomToCollisionCheck( ToolId, 'TH_'..sHeadName, vThColl) then return false end
DumpCollisionCheck( vThColl, 'ToolHolder Collision Objects :', 4)
-- aggiungo la geometria trovata
for i = 1, #vThColl do
EmtAddCollisionObjEx( nInd, vThColl[i].Fr, vThColl[i].Ty, vThColl[i].Mv, vThColl[i].P1, vThColl[i].P2, vThColl[i].P3)
end
return true, #vThColl
end
---------------------------------------------------------------------
return EmtGenerator
@@ -0,0 +1,19 @@
-- %MACRO_NAME%.lua by EgalTech s.r.l. %DATE_TIME%
-- Macro
-- Variabili predefinite
-- MACRO.W = beam width
-- MACRO.H = beam height
-- MACRO.L = beam length
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
print( 'Macro %MACRO_NAME% started')
local vPar = {%vPar%}
local sPar = %sPar%
MACRO.FEATUREID = EgtBeamAddProcess( %AddFeature%, vPar, sPar)
@@ -0,0 +1 @@
ImportBtl : C:\ProgramData\Egaltech\EgtBeamWall\Projs\0001\Casa Mosca.btl
Binary file not shown.
Binary file not shown.
+62
View File
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=10; charset=utf-8"/>
<title>EgtCAM5 - C:\ProgramData\Egaltech\EgtBeamWall\Projs\0001\2.bwe 2022/05/04 19:29:45</title>
<style type = "text/css">
caption {
margin: 10px;
font: 200% arial, sans-serif;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
table {
margin: 30px;
background-color: #f2f2f2;
}
th, td {
padding: 0.4rem;
text-align: center;
}
tr.total {
background-color: #e6e6e6;
}
</style>
</head>
<body>
<table>
<caption>Machinings</caption>
<tr>
<th></th>
<th>Time [h:m:s]</th>
<th>Len [m]</th>
<th>Tool</th>
</tr>
<tr>
<td>Cut_2_1</td>
<td>00:00:18</td>
<td> 2.1</td>
<td>Lama1200</td>
</tr>
<tr class="total">
<td>TOTAL</td>
<td>00:00:18</td>
<td> 2.1</td>
<td></td>
</tr>
</table>
<table>
<caption>Tools</caption>
<tr>
<th></th>
<th>Len [m]</th>
</tr>
<tr>
<td>Lama1200</td>
<td> 2.1</td>
</tr>
</table>
</body>
</html>
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
ERR=0
---
ROT=0
CUTID=369
TASKID=1849
ERR=0
---
ROT=0
CUTID=0
TASKID=0
TIME=19
Binary file not shown.
+62
View File
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=10; charset=utf-8"/>
<title>EgtCAM5 - C:\ProgramData\Egaltech\EgtBeamWall\Projs\0001\5.bwe 2022/05/19 11:53:22</title>
<style type = "text/css">
caption {
margin: 10px;
font: 200% arial, sans-serif;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
table {
margin: 30px;
background-color: #f2f2f2;
}
th, td {
padding: 0.4rem;
text-align: center;
}
tr.total {
background-color: #e6e6e6;
}
</style>
</head>
<body>
<table>
<caption>Machinings</caption>
<tr>
<th></th>
<th>Time [h:m:s]</th>
<th>Len [m]</th>
<th>Tool</th>
</tr>
<tr>
<td>Cut_5_1</td>
<td>00:00:17</td>
<td> 1.9</td>
<td>Lama1200</td>
</tr>
<tr class="total">
<td>TOTAL</td>
<td>00:00:17</td>
<td> 1.9</td>
<td></td>
</tr>
</table>
<table>
<caption>Tools</caption>
<tr>
<th></th>
<th>Len [m]</th>
</tr>
<tr>
<td>Lama1200</td>
<td> 1.9</td>
</tr>
</table>
</body>
</html>
Binary file not shown.
+102
View File
@@ -0,0 +1,102 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=10; charset=utf-8"/>
<title>EgtCAM5 - C:\ProgramData\Egaltech\EgtBeamWall\Projs\0001\7.bwe 2022/05/04 19:19:42</title>
<style type = "text/css">
caption {
margin: 10px;
font: 200% arial, sans-serif;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
table {
margin: 30px;
background-color: #f2f2f2;
}
th, td {
padding: 0.4rem;
text-align: center;
}
tr.total {
background-color: #e6e6e6;
}
</style>
</head>
<body>
<table>
<caption>Machinings</caption>
<tr>
<th></th>
<th>Time [h:m:s]</th>
<th>Len [m]</th>
<th>Tool</th>
</tr>
<tr>
<td>Free_7</td>
<td>00:00:17</td>
<td> 1.0</td>
<td>Fresa25x130</td>
</tr>
<tr>
<td>Drill_1</td>
<td>00:00:06</td>
<td> 0.5</td>
<td>Fresa25x130</td>
</tr>
<tr>
<td>Drill_2</td>
<td>00:00:07</td>
<td> 0.5</td>
<td>Fresa25x130</td>
</tr>
<tr>
<td>Cut_7_4</td>
<td>00:00:42</td>
<td> 7.4</td>
<td>Lama1200</td>
</tr>
<tr>
<td>Cut_7_5</td>
<td>00:00:13</td>
<td> 2.5</td>
<td>Lama1200</td>
</tr>
<tr>
<td>Cut_7_6</td>
<td>00:00:41</td>
<td> 7.6</td>
<td>Lama1200</td>
</tr>
<tr>
<td>Cut_7_1</td>
<td>00:00:20</td>
<td> 2.5</td>
<td>Lama1200</td>
</tr>
<tr class="total">
<td>TOTAL</td>
<td>00:02:29</td>
<td>21.9</td>
<td></td>
</tr>
</table>
<table>
<caption>Tools</caption>
<tr>
<th></th>
<th>Len [m]</th>
</tr>
<tr>
<td>Fresa25x130</td>
<td> 1.9</td>
</tr>
<tr>
<td>Lama1200</td>
<td>20.0</td>
</tr>
</table>
</body>
</html>
Binary file not shown.
+21
View File
@@ -0,0 +1,21 @@
ERR=0
---
ROT=0
CUTID=562
TASKID=572
ERR=0
---
ROT=0
CUTID=562
TASKID=574
ERR=0
---
ROT=0
CUTID=562
TASKID=576
ERR=0
---
ROT=0
CUTID=0
TASKID=0
TIME=150
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,19 @@
-- %MACRO_NAME%.lua by EgalTech s.r.l. %DATE_TIME%
-- Macro
-- Variabili predefinite
-- MACRO.W = beam width
-- MACRO.H = beam height
-- MACRO.L = beam length
-- Intestazioni
require( 'EgtBase')
_ENV = EgtProtectGlobal()
EgtEnableDebug( false)
print( 'Macro %MACRO_NAME% started')
local vPar = {%vPar%}
local sPar = %sPar%
MACRO.FEATUREID = EgtBeamAddProcess( %AddFeature%, vPar, sPar)
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Some files were not shown because too many files have changed in this diff Show More