DataGunstock :

- prime modifiche per macchina Mazak.
This commit is contained in:
Dario Sassi
2020-09-29 17:54:17 +00:00
parent bf287e2dc3
commit c092a21905
2 changed files with 41 additions and 22 deletions
+3 -3
View File
@@ -438,9 +438,9 @@ local function InsertInLayer( sNgeFile, nLayId)
end
-----------------------------------------------------------------
function EGB.ImportCnc( sDir, sTmpDir, sName, vSubst, bAddM6ToT3x, nLayId)
local sSubFile = sDir .. sName
local sCncFile = sTmpDir .. sName .. '.cnc'
function EGB.ImportCnc( sDir, sTmpDir, sName, sExt, vSubst, bAddM6ToT3x, nLayId)
local sSubFile = sDir .. sName .. ( sExt or '')
local sCncFile = sTmpDir .. sName .. ( sExt or '.cnc')
local sNgeFile = sTmpDir .. sName .. '.nge'
-- Converto file Iso parametrico in numerico
if not ConvertSubToCnc( sSubFile, sCncFile, vSubst, bAddM6ToT3x) then
+38 -19
View File
@@ -1,4 +1,4 @@
-- Main.lua by Egaltech s.r.l. 2016/10/18
-- Main.lua by Egaltech s.r.l. 2020/09/28
-- Main gestione lavorazioni Gunstock
-- Intestazioni
@@ -143,16 +143,20 @@ local function GetRawDim()
m_vSboMove = nil
else
sLine = sLine:gsub( '#MUOVI_SBO', '')
sLine = sLine:gsub( 'X', '')
sLine = sLine:gsub( 'Y', ',')
sLine = sLine:gsub( 'R', ',')
local vsTok = EgtSplitString( sLine, ',')
m_vSboMove.sX = EgtTrim( vsTok[1])
m_vSboMove.dX = 0
m_vSboMove.sY = EgtTrim( vsTok[2])
m_vSboMove.dY = 0
m_vSboMove.sR = EgtTrim( vsTok[3])
m_vSboMove.dR = 0
local vsTok = EgtSplitStringPlus( sLine, 'XYR')
m_vSboMove.sX = '0' ; m_vSboMove.dX = 0
m_vSboMove.sY = '0' ; m_vSboMove.dY = 0
m_vSboMove.sR = '0' ; m_vSboMove.dR = 0
for i = 1, #vsTok do
local sId = string.sub( vsTok[i], 1, 1)
if sId == 'X' then
m_vSboMove.sX = EgtTrim( string.sub( vsTok[i], 2))
elseif sId == 'Y' then
m_vSboMove.sY = EgtTrim( string.sub( vsTok[i], 2))
elseif sId == 'R' then
m_vSboMove.sR = EgtTrim( string.sub( vsTok[i], 2))
end
end
sLine = EGB.GetLine()
if not sLine then return false end
end
@@ -682,6 +686,7 @@ function GGD.CreateGunstock()
local sMachIni = EgtGetCurrMachineDir() .. '\\' .. m_sMachName .. '.ini'
local bTwoHeads = ( EgtGetStringFromIni( 'Gunstock', 'TwoHeads', '0', sMachIni) == '1')
local bAddM6ToT3x = ( EgtGetStringFromIni( 'Gunstock', 'AddM6ToT3x', '1', sMachIni) == '1')
local bMazak = ( EgtGetStringFromIni( 'Gunstock', 'Type', 'Cms', sMachIni) == 'Mazak')
-- Recupero parametri (opzionali)
if not GetParams() then
@@ -892,7 +897,7 @@ function GGD.CreateGunstock()
-- Eventuale rototraslazione
if m_vSboMove then
EgtRotate( nId, ORIG(), Z_AX(), m_vSboMove.dR, GDB_RT.GLOB)
EgtMove( nId, Vector3d( m_vSboMove.dX, m_vSboMove.dY,0))
EgtMove( nId, Vector3d( m_vSboMove.dX, m_vSboMove.dY, 0))
end
-- Creazione del solido
Sol = EgtSurfTmByRegionExtrusion( Ly, nId, Z_AX() * m_vRaw.dAlt * m_dCoeffAlt)
@@ -962,15 +967,25 @@ function GGD.CreateGunstock()
local l = EgtFrame( Lm, Frame3d( ORIG()))
EgtSetName( l, 'Ref')
-- inserimento lavorazione (in ordine crecente di E)
local vSubst = { {'E1', '25.5'}, {'E2', '25.5'}, {'E101', '25.5'}, {'E102', '25.5'}}
if not EGB.ImportCnc( sSubDir, sTmpDir, 'Sub'..vMach.sName, vSubst, bAddM6ToT3x, vMach.nLay) then
local vSubst
local sSubName
local sSubExt
if bMazak then
sSubName = vMach.sName
sSubExt = '.EIA'
else
vSubst = { {'E1', '25.5'}, {'E2', '25.5'}, {'E101', '25.5'}, {'E102', '25.5'}}
sSubName = 'Sub'..vMach.sName
end
if not EGB.ImportCnc( sSubDir, sTmpDir, sSubName, sSubExt, vSubst, bAddM6ToT3x, vMach.nLay) then
EgtOutLog( 'Errore inserimento percorso di lavorazione ' .. vMach.sName)
end
end
EgtSetGridFrame()
-- Gestione macchina
if not EgtGetCurrMachineName() then
local sMachineName = EgtGetCurrMachineName()
if not sMachineName then
EGB.WriteErrLine( 'ERR=201\nErrore : non esiste una macchina corrente')
GGD.ERR = 201
return
@@ -981,10 +996,14 @@ function GGD.CreateGunstock()
local tabOri = EgtGetTableRef( 1)
-- Posizionamento delle morse per calcio
local nFix
if m_vRaw.dLen < LEN_MIN_RIFLE then
nFix = EgtAddFixture( 'Vise2H85', Vector3d( 629, 350-1.49, 0), 0, m_vRaw.dAlt * m_dCoeffAlt)
if bMazak then
nFix = EgtAddFixture( 'ViseNew', Vector3d( 350, 250, 0), 0, m_vRaw.dAlt * m_dCoeffAlt)
else
nFix = EgtAddFixture( 'ViseRifle', Vector3d( 600, 350-1.49, 0), 0, m_vRaw.dAlt * m_dCoeffAlt)
if m_vRaw.dLen < LEN_MIN_RIFLE then
nFix = EgtAddFixture( 'Vise2H85', Vector3d( 629, 350-1.49, 0), 0, m_vRaw.dAlt * m_dCoeffAlt)
else
nFix = EgtAddFixture( 'ViseRifle', Vector3d( 600, 350-1.49, 0), 0, m_vRaw.dAlt * m_dCoeffAlt)
end
end
-- Posizionamento del grezzo in macchina
local ColA = Color3d( 255, 165, 0, 30)
@@ -1054,7 +1073,7 @@ function GGD.CreateGunstock()
EGB.WriteOutLine( m_vParams[i].sVar .. '=' .. EgtNumToString( m_vParams[i].dVal, 3))
end
if ( bTwoHeads and #m_vMachs > 0) then
local sTcPos = EgtGetInfo( m_vMachs[1] .nLay, 'TCPOS')
local sTcPos = EgtGetInfo( m_vMachs[1].nLay, 'TCPOS')
if not sTcPos then
EGB.WriteErrLine( 'ERR=208\nErrore non trovata posizione utensile in CU')
GGD.ERR = 208